Skip to content

nicholas-maltbie/RecolorShaderUnity

Repository files navigation

Recolor Shader Unity

Example of recolored cats with a rotating gif

This project demonstrates an example of how to use the Recolor shader developed in Unity's Universal Render Pipeline to recolor a grey scale image using two different colors dynamically. I have made a video, Custom Color Shader! Dynamic Recoloring Explained, which talks through the examples of this project and how the shader works.

This shader was developed as part of the Falling Parkour Project here - https://github.com/nicholas-maltbie/FallingParkour

This project is developed using Unity LTS Release 2021.1.19f1. Install this version of Unity from Unity Hub using this unity hub link unityhub://2021.1.19f1/d0d1bb862f9d

Example recoloring of a grey scale pattern into different color combinations

This is an open source project licensed under a MIT License. Feel free to use a build of the project for your own work. If you see an error in the project or have any suggestions, write an issue or make a pull request, I'll happy include any suggestions or ideas into the project.

Samples

Rendering of the stages within one of the shader graphs for recoloring a grey scale texture to be multiple colors

Here is a summary of the various examples in this project. Each link provides a tutorial on how part of the shader works and the final link shows the completed shader in action.

  1. Hello Shaders - Basic Shader introduction.
  2. Colored Shaders - Create a solid color shader.
  3. Recoloring Images - Recoloring a black and white image.
  4. Combining Images - Combining two images together.
  5. Final Combination - Recoloring a black and white image two different colors.

After going through these tutorials, you will know how to dynamically recolor grey scale using the shaders and materials in this project!

Varying the colors on a box with a triangle pattern

Development

If you want to help with the project, feel free to make some changes and submit a PR to the repo.