-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add FullscreenPassNode for postprocessing #1988
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of comments on the code, but my first thought is that the tonemapping should live in its own plugin outside of the render code.
attachment: TextureAttachment::Input("color_attachment".to_string()), | ||
resolve_target: None, | ||
ops: Operations { | ||
load: LoadOp::Clear(Color::rgb(0.1, 0.2, 0.3)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a resource for clear color we could use here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Good point.
mip_level_count: 1, | ||
sample_count: msaa.samples, | ||
dimension: TextureDimension::D2, | ||
format: TextureFormat::Bgra8Unorm, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when a user wants a different buffer format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair question, that's one for the how do we compose a rendergraph discussion.
I'm planning on splitting this PR in three. Where the separate PRs have been created, I'll add the reference:
|
In order to preserve useful comments, this is quoted from Akorian on Discord (I don't know your github handle).
|
I've just committed a first (mostly) working version of a FullscreenPassNode that can be used to do postprocessing.
I've also done some work to (optionally) integrate it into the base rendergraph. Because of how bevy_render, bevy_pbr and bevy_ui create the render graph, there's still some issues there:
add_post_pass
config to determine whether it should create an edge from that instead of from MainPass. Similarly, this cannot be set up in bevy_render, because it can't know if there is a UiPass. This could be solved by having plugin config live inResources
, but that would create these weird dependencies between plugins;There's an ordering problem whereTextureNode
creates the textures inupdate()
, butFullscreenPassNode
needs the textures inprepare()
that causes a full frame delay before FullscreenPassNode has access to the textures.Other things I'm working on:
Doesn't currently work with MSAA, this should be relatively minor to fixEnded up adding a separate Resolve pass;Checks whether all bind groups are bound in a pretty bad way;Res<RenderResourceBindings>
;Properly handling window resolution;Draw a single triangle instead of a quad;While I'm iterating on this, I'd love to get some feedback on the general approach. Some open questions:
How should FullscreenPassNode take textures? Currently you pass it a Vec of textures + names to pass to a shader. Alternatively these could all go throughRenderGraph textures+samplers are connected as slot_edges to FullscreenPassNode. Other textures or resources should go throughRes<RenderResourceBindings>
;Res<RenderResourceBindings>
.Depends on #1998. Rebase with
git rebase --onto main <last commit of #1998>
.