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

Add low level post process example using a custom render pass #6909

Merged
merged 16 commits into from
Mar 16, 2023

Conversation

IceSentry
Copy link
Contributor

@IceSentry IceSentry commented Dec 10, 2022

Objective

  • The current post process example is very high level and inefficient.
  • A lot of people want to dive deeper in bevy's rendering, but we don't have any low level rendering examples and the source code is very sparse in terms of docs explaining what's going on.

Solution

  • Use the post process features added in 0.9 in an example with a bit more docs.

Notes

The actual shader is pretty much the same as the current post_process example but adapted for the custom render pass. So it's still just chromatic aberration. This could probably be something slightly more complicated to show using more bindings. For example the offset could be configured from a binding instead of being hardcoded.

I originally wanted to use this example to also teach about all the various render stages, but it's already quite complex so I chose to keep it simple.

@IceSentry IceSentry added A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples labels Dec 10, 2022
@IceSentry IceSentry marked this pull request as ready for review March 15, 2023 05:08
Copy link
Contributor

@JMS55 JMS55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of minor suggestions on what to reword and explain better.

Major stuff I noticed missing:

  • No usage of prepare/queue systems to create textures or bind groups
  • No usage of specialized pipelines and per-view pipelines, or shader defs for when runtime uniform settings aren't desired
  • I feel like we should mention that you you can use fancier filters and stuff with ExtractComponent, implement it manually instead of deriving, or implement it entirely manually with a system. Maybe this should go into the rustdoc, though.

Random other thoughts:

  • Node boilerplate is pretty bad, can't wait for you to improve it
  • Perhaps we should take ExtractComponent/Uniform one step further, and add some kind of template trait for preparing a list of textures based on descriptors, preparing a bind group, creating one or more specialized pipelines, and then possibly integrating the pipelines into a render node. Would greatly simplify TAA/SSAO/etc.

assets/shaders/post_process_pass.wgsl Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Show resolved Hide resolved
examples/shader/post_process_pass.rs Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
IceSentry and others added 7 commits March 15, 2023 01:47
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
assets/shaders/post_process_pass.wgsl Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
examples/shader/post_process_pass.rs Outdated Show resolved Hide resolved
@superdump superdump added this pull request to the merge queue Mar 16, 2023
Merged via the queue into bevyengine:main with commit 9d1193d Mar 16, 2023
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
…gine#6909)

Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
…gine#6909)

Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
@IceSentry IceSentry deleted the post-process-pass branch March 27, 2023 20:22
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-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants