I was creating a fragment shader for adding a texture to the parts of my characters and objects in shadow, and I was wondering if there was a way to get the LIGHT value, the one available in the light shader, in the fragment shader?
I’m still a bit new to creating shaders so maybe there’s a better way of implementing this, but I’ve searched around and haven’t found a good solution. Any help would be appreciated!
You might be able to use a varying, but the docs say light is a function in part of the fragment shader so it can only be used to pass from void fragment() to void light(). Your best best is to find a way to adhere to this pipeline direction.
Thanks for the response! The shader works if I use a static light vector for both the fragment and light shader, however I want the texture added to the albedo with regard to the light level from multiple light sources, and a static vector can’t give that information. I also tried adjusting the albedo in the light shader but albedo is just a constant in the light shader, so I’m kind of at an impasse.
This kind of works, the applied texture’s color still changes a bit depending on the color of the underlying texture but I’ll tweak it and see if I can make it look a bit better. Thanks for putting me on the right track.