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
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.
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.
- Hello Shaders - Basic Shader introduction.
- Colored Shaders - Create a solid color shader.
- Recoloring Images - Recoloring a black and white image.
- Combining Images - Combining two images together.
- 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!
Here is a description of the various directories in the project
Assets/Recolor/Materials
contains the materials for the project.Assets/Recolor/Models
contains the models used in the project.Assets/Recolor/Scenes
contains various scenes for the example project. Each scene is numbered and progress in order 1, 2, ... This readme file will explain the assets in each scene.Assets/Recolor/Shaders
contains the shaders for the project.Assets/Recolor/Textures
contains the image textures used in examples
If you want to help with the project, feel free to make some changes and submit a PR to the repo.
When working with the project, make sure to setup the .githook
if you want to edit the code in the project. In order
to do this, use the following command to reconfigure the core.hooksPath
for your repository
git config --local core.hooksPath .githooks