Godot Version
Latest
Question
I am trying to achieve a visual effect where the pixel original color would be mapped to a palette, then the shade would be determined based on said palette.
Here is the effect in 2D on another framework : x.com
So for this I need two information available in the shader :
- The original pixel color to map to the desired palette color. That part was easy to do in a fragment shader
- The amount of light this pixel receives. That’s what I do not know.
Can use the light function of the spatial shader for this ?
Another idea was to use subviewports, one for the unshaded image, the other for the light value and then combine the two textures. But upon closer reading of the documentation Using Viewports — Godot Engine (stable) documentation in English I see that the subviewport would capture its geometry, thus requiring to draw everthing twice ?
I see that I can pass information from the fragment to the light but I need it the other way around and what to keep the built in light calculation
If anyone wants to shime in on this that would be more than welcome