How to create a shader that mimics “Canvas Modulate”?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By HeroicNate

Does anyone know how I would recreate canvas modulate as a shader?

I am looking to create a tinting shader that works like canvas modulate that I can apply to individual nodes. Canvas modulate appears to apply the color before the Light2D hits it, where modulating at node level will change the color of the light as well.

This is important in that if I set canvas modulate to black, 2D lights will lighten the blackness. If I modulate a node to black, it stays black. If I modulate to color at node level right now, it also tints the light color.

Any ideas how canvas modulate works and how I can replicate it?

Canvas modulate on left, node modulate on right