Godot Version
4.3
Question
I’m trying to make a shader that calculates values before and after the light() pass. The idea is to be able to calculate how much the object’s color changed based on the lighting pass in order to calculate exposure*. The thing is that in order to do this I’d have to calculate the value before, which sounds doable in the fragment() function, but calculating the change AFTER the light() function has ran has me stumped.
Is there a way to wrap the light() function inside another function in order to save the ALBEDO and other values before and after the pass?
(*) Many people have suggested raycasting from light sources to the object surface and similar solutions. The idea is for the object to calculate this on itself, instead of depending on every light source (which could potentially be too many) to raycast to several parts of its mesh.