Hi, as the title says I’m trying to create a 2d shader that does the following:
- takes an image
- takes the white pixels of such image and makes them cycle through colors creating a rainbow effect
- leaves every other part of the texture that is not white alone
How would one go about creating an script that achieves this? I’m not looking for precoded or market place solutions because I want this to be a learning experience. Any kind of guidance or help would be appreciated.
- color = sample texture
- rainbow = sample rainbow Ramp texture by time
3 color = color == white? rainbow : color
4 return color
will have white halo and noise if you have almost white pixel (for example due to compression artefact)
Another solution is to:
- compute luminosity of texture,
- pow it then use that as a mask (multiply) on rainbow (white = color, black stay black),
- minus one multiply on color (to make the white black),
- then add the masked rainbow to the minus one color result