Skip to content
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

Access more common buffers in RenderSceneBuffersRD #10396

Open
nekotogd opened this issue Aug 8, 2024 · 3 comments
Open

Access more common buffers in RenderSceneBuffersRD #10396

nekotogd opened this issue Aug 8, 2024 · 3 comments

Comments

@nekotogd
Copy link

nekotogd commented Aug 8, 2024

Describe the project you are working on

A post-processing outline shader using the new CompositorEffect API that uses sobel filtering on the depth and normals buffer to detect edges.

Describe the problem or limitation you are having in your project

RenderSceneBuffersRD default context doesn't provide access to the normals buffer.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Allow access to more buffers in the default rendering context such as the normals / roughness buffer, maybe lighting buffer, unshaded color (albedo) buffer etc.

Ideally whatever buffers we can see from the viewport debug views to be accessible, if it is possible to provide them for use with the CompositorEffect API.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Have RenderSceneBuffersRD provide something like:

var normals_image : RID = render_scene_buffers.get_buffer_layer(0, RenderSceneBuffersRD.NORMALS_ROUGHNESS_BUFFER)
var albedo_image : RID = render_scene_buffers.get_buffer_layer(0, RenderSceneBuffersRD.UNSHADED_BUFFER)

If this enhancement will not be used often, can it be worked around with a few lines of script?

You can access the normals + roughness buffer through spatial shaders but this requires you to set up a full screen quad and it becomes really difficult to stack post-processing effects, which I believe is exactly what the CompositorEffect API aims to solve.

Is there a reason why this should be core and not an add-on in the asset library?

There is currently no way to access these buffers without modifying the engine, so you cannot actually build this as an add-on for the asset library.

@Calinou
Copy link
Member

Calinou commented Aug 8, 2024

@nekotogd
Copy link
Author

nekotogd commented Aug 8, 2024

Did some snooping around, apparently I am actually able to access the normal / roughness buffer from the "forward clustered" context.

image

@Calinou
Copy link
Member

Calinou commented Aug 8, 2024

I don't think the engine keeps an unshaded buffer for you to use, as Godot uses forward rendering. Such buffers are generally only available in a deferred renderer (which is planned at some point in the future).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants