-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Per entity render pass exclusion (part 1 of 2) #22316
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
base: main
Are you sure you want to change the base?
Per entity render pass exclusion (part 1 of 2) #22316
Conversation
…eterPansShadowExample branch
|
Design doc: ENTITY_CONFIGURABLE_RENDER_PASS_PARTICIPATION.md |
|
The generated |
d67cca6 to
cbadeaa
Compare
|
Couldn't you use render layers to achieve the same or very similar result? |
|
Also, that's adding a lot more branches in the hot path. Can you benchmark this to confirm this isn't a regression. |
This is my immediate question too |
RenderLayers can approximate some cases, but it’s “which views see this entity”. This PR is “which render passes does this entity participate in (main/shadow/…)” even within the same view. For shadow-only, layers usually require coordinating layers across all shadow-casting lights, which is why I leaned toward a pass mask.
Done (30 second warm-up then 30 second runs of nvidia-smi +-----------------------------------------------------------------------------------------+ |
Objective
Enable per-entity participation control for Bevy’s primary render passes, so an entity can be excluded from main camera rendering (opaque/alpha-mask/transparent/transmissive) and/or shadow rendering without requiring material/shader workarounds.
This is Part 1 of “per-entity render pass exclusion”: focuses on MainPass + Shadow participation (and introduces prepass-related bits followed up in another branch as Part_2.
Solution
Added a new public, component-driven API:
only_shadow_caster.rs
Testing
Tested on Debian 13 with discreet Nvidia GPU and Nvidia driver version: 590.48.01
I did not test Windows/macOS
cargo test -p bevy_render --libcargo test -p bevy_pbr --libRun the new example:
Verify that “shadow-only” entities still cast shadows while being invisible in the main camera.