Skip to content

Add FullscreenMaterial #20414

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

IceSentry
Copy link
Contributor

@IceSentry IceSentry commented Aug 4, 2025

Objective

  • Users often want to run a fullscreen shader but the current solution involves copying the custom_post_processing example which is a 350 line file with a lot of low level wgpu complexity. Users shouldn't have to deal with that just to make a fullscreen shader

Solution

  • Introduce a new FullscreenMaterial trait and FullscsreenMaterialPlugin
  • This new material will run a fullscreen triangle with the specified shader. It builds on top of the existing FullscreenShader infrastructure
  • It lets user customize the node ordering. There's no defaults right now becausae it's intended as a bit of a primitive plugin. Eventually we could have some kind of default for custom post processing

Testing

Made a new fullscreen_material example and made sure it works

Follow up

Once this is merged there are various things that should be done to improve it. Add the option to bind the depth texture, offer defaults for post processing, use a full AsBindGroup, add a way to bind the gbuffer.

@alice-i-cecile alice-i-cecile added the M-Needs-Release-Note Work that should be called out in the blog due to impact label Aug 4, 2025
@alice-i-cecile alice-i-cecile added this to the 0.18 milestone Aug 4, 2025
@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen labels Aug 4, 2025
Copy link
Contributor

github-actions bot commented Aug 4, 2025

It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note.

Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes.

@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon labels Aug 4, 2025
@IceSentry IceSentry force-pushed the fullscreen_material branch from b0f9763 to 70e61bd Compare August 9, 2025 03:15
@IceSentry IceSentry marked this pull request as ready for review August 9, 2025 03:39
@brianreavis
Copy link
Contributor

As a 2D user, when I first read “FullscreenMaterial“ I thought this was for ergonomically inserting a fullscreen non-mesh into an existing render pass – which would be handy for applying a vignette or film w/o the cost of a new render pass.

I’d lean into the PostProcess naming in this PR: PostProcessMaterial / PostProcessMaterialPlugin.

@IceSentry
Copy link
Contributor Author

I disagree the main goal of this api is to be a general purpose fullscreen render pass. The main feature is that it can be inserted in any order because some people don't want a post process effect, they just want to do something like render their entire game in a fullscreen shader in the main pass. Like I mentioned in the notes. A post processing version of this would be built on top of the same api but with pre configured ordering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible M-Needs-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants