You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system or device - Godot version:
Arch Linux, godot 3.0 bb9daac
Issue description:
I would like to access light data (specifically light positions) in my shaders, but it does not appear to be exposed.
First I tried accessing "omni_lights" and "omni_light_indices" (declared + used in scene.glsl) in my fragment() and light() shader functions. They were inaccessible.
Then I tried adding the following lines to shader_compiler_gles3.cpp:
But the new names (ex: "OMNI_LIGHTS") were also inaccessible. I'm guessing their types also need to be registered in shader_types.cpp, but it looks like theres no way to register struct or array types. Which is a problem because omni_lights is an array of LightData.
Unless I hear otherwise, I won't continue working on this as I'm guessing @reduz probably knows how this should be done.
Or maybe this functionality already exists and I'm totally wrong 😄
The text was updated successfully, but these errors were encountered:
does it also concerns spatial shaders? i want to know light vector (and may be strength will be also good thing to know) to calculate stuff on the planet atmosphere, but there is nothing in spatial shader that concerns lights.
While we do have light shaders now (accessible via the light() function), they still aren't a full solve for me.
The specifics of my scenario:
I am selecting a texture to sample based on light intensity (calculated using light distance, attenuation, etc of the lights in the scene). The albedo is set to the sampled texture color. This is used to create a "sketchy shader" effect viewable here. I am currently hard coding light information but I have no way of accessing the real lights. I could try to recreate the effect by setting DIFFUSE_LIGHT to the sampled color in light shaders, but this is both more expensive (as I need to sample the texture once per light) and less flexible.
Exposing the raw light data would enable more shader types and it wouldn't be any more expensive. That information is already in scope for vertex and fragment shaders in scene.glsl, it just needs to be bound to godot's shading language.
Operating system or device - Godot version:
Arch Linux, godot 3.0 bb9daac
Issue description:
I would like to access light data (specifically light positions) in my shaders, but it does not appear to be exposed.
First I tried accessing "omni_lights" and "omni_light_indices" (declared + used in scene.glsl) in my fragment() and light() shader functions. They were inaccessible.
Then I tried adding the following lines to shader_compiler_gles3.cpp:
But the new names (ex: "OMNI_LIGHTS") were also inaccessible. I'm guessing their types also need to be registered in shader_types.cpp, but it looks like theres no way to register struct or array types. Which is a problem because omni_lights is an array of LightData.
Unless I hear otherwise, I won't continue working on this as I'm guessing @reduz probably knows how this should be done.
Or maybe this functionality already exists and I'm totally wrong 😄
The text was updated successfully, but these errors were encountered: