-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose scene directional light data through the compositor effect callback #11264
Comments
@Calinou Here is the exposed directional light buffer
Looks like kinda easy to implement. But since there is a separate light_storage class, im not sure if it could be a part of the render_scene_data |
@BadMachine it was always my intention to expose more of the buffers used during rendering to compositor effects. #94193 is a first step in that process so you can include the structures Godot uses internally. Exposing the RIDs of the buffers is a next step. |
@BastiaanOlij |
Hard to say at this point in time, my focus currently is on a few XR tasks so it's a question of when I find a bit of free time to take the next steps (and that will first be rebasing and touching up the custom templates work). Right now I'm waiting for the built-in includes PR to be merged, it's a royal PITA to maintain multiple PRs that are all dependent on another PR. |
Describe the project you are working on
Godot addon that adds realistic sky/post-processing effects.
Describe the problem or limitation you are having in your project
Scene directional light data
Currently, we can access render scene buffers using the following code:
However, this buffer lacks crucial light source data, such as directional light direction or color. This limitation forces developers to implement a workaround by manually passing the light data from the outside. Here's the an example of the process:
This approach places the entire responsibility of managing light data on the developer, which is inefficient and error-prone. For a practical implementation example, you can refer to this excellent Godrays implementation
Shadow Atlases
Another critical issue is the inability to access shadowmaps (shadow atlases) within post-processing compute shaders. While the compositor hook provides access to render scene buffers and their layers:
Shadowmaps remain inaccessible, which severely limits advanced rendering effects. For example, it is impossible to exclude Mie scattering effects in atmospheric rendering without sampling the shadowmap:
![Image](https://private-user-images.githubusercontent.com/50546204/391165388-dc1042a4-669d-4f62-9d63-baf1a8128a0c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5ODIyNTYsIm5iZiI6MTczOTk4MTk1NiwicGF0aCI6Ii81MDU0NjIwNC8zOTExNjUzODgtZGMxMDQyYTQtNjY5ZC00ZjYyLTlkNjMtYmFmMWE4MTI4YTBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDE2MTkxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZjOGNmYTMzNmIxN2EyYmI5ZmFjYTgwNTFhMGQ0MDJkMDdjOGE0MGIxODQ2N2QzMWU3MmU3YWY1YWEwZGVlYTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.yLZvHGEwlhTaq8yKbHSsfTGpvM8F2_KFBjmT9UJ-CUk)
Why These Features Are Critical
Both directional light data and shadow atlas access are fundamental for modern visual effects in rendering pipelines. Without these, developers are forced to create custom, resource-intensive solutions to work around these limitations. Exposing this data directly to compositor effects would:
By addressing these issues, Godot’s rendering pipeline would become significantly more robust and developer-friendly.
I know that there is a separate PR for shader templates but as I understand its related to the gdshader only
There is also another PR with shader includes and I cant wait to finally get it, but it's not related to exposing light data.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Exposing Directional Light Data to Compositor Effects
Add a mechanism to directly expose directional light attributes (e.g., direction, color, and intensity) to the compositor effects. This could involve integrating the light data into the existing uniform buffers or providing a dedicated API for accessing light sources within the RenderSceneDataRD object.
Shadowmap (Shadow Atlas) Access for Post-Processing
Allow access to shadowmaps (also known as shadow atlases) within the compositor framework. This can be achieved by exposing the shadowmap textures through the RenderSceneDataRD interface, similar to how color, depth, and motion layers are currently handled.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Directional Light Data
Shadowmap (Shadow Atlas)
If this enhancement will not be used often, can it be worked around with a few lines of script?
Directional Light Data
Yes, it can be worked around with quite many lines of code :) Which as I explained above is not efficent and practically comfortable way.
Shadowmap (Shadow Atlas)
Unfortunatelly there is no option to work this around with script.
Is there a reason why this should be core and not an add-on in the asset library?
I assume the reason is the Compositor itself. It has been developed as solution for post processing effects.
The text was updated successfully, but these errors were encountered: