• 2D
  • How does modulate work?

If start with an image that's white, the modulate property lets me change the color on the fly to whatever I want.

If the image is not white, the modulate color appears to be mixed with the original color, but it's not clear exactly what algorithm is used to do the mixing.

And is modulate "expensive"? I.e., if I want to have several sprites that are the same shape but different (solid) colors, is it more efficient to use separate texture images than to use one white image and adjust the colors with modulate? Or does it not matter?

I like modulate on UI elements, because I can create the icons as solid white with a transparent background and then change the color in the inspector. This makes tweaking easy, and can be done with code, which opens other options (like a health bar changing from green to red when health is low).

You modulate a value with vector3/rgb value by multiplying. Not to be confused with a modulo function though.

edit: apparently they've renamed modulo in the new visual shader editor to remainder to avoid this confusion.