Revert Screen Space Transmission Gate for Mesh Bind Groups#24089
Revert Screen Space Transmission Gate for Mesh Bind Groups#24089alice-i-cecile merged 3 commits intobevyengine:mainfrom
Conversation
09df482 to
c8734aa
Compare
c8734aa to
5b1581d
Compare
|
This screen space transmission issue is causing problems (and strobing!) with a couple other examples at least: |
beicause
left a comment
There was a problem hiding this comment.
I can accept this since ScreenSpaceTransmission is a required component and enabled by default. We can add a way to disable it in a separate PR.
| if key.contains(MeshPipelineKey::ATMOSPHERE) { | ||
| shader_defs.push("ATMOSPHERE".into()); | ||
| } | ||
| if key.intersects(MeshPipelineKey::SCREEN_SPACE_SPECULAR_TRANSMISSION_RESERVED_BITS) { |
There was a problem hiding this comment.
Why not check all the bits for the different quality levels?
There was a problem hiding this comment.
If I understand your question and the code correctly, the quality level is encoded in 2 bits (for low, medium, high, and ultra), a low quality level is encoded as a 0, and we want SCREEN_SPACE_TRANSMISSION to be enabled in that scenario anyway (or else low quality just doesn’t render — I tested with the transmission example). Checking the bits for each individual quality would be redundant in that case since any combo of bits should result in screen space transmission being enabled, so I’m removing the useless gating.
I’m interpreting that you mean to check every individual quality level as already done so here:
bevy/crates/bevy_pbr/src/render/mesh.rs
Lines 3555 to 3567 in 5b1581d
…ransmission_gating
Objective
Solution
So, originally the
SCREEN_SPACE_TRANSMISSIONwas enabled withkey.intersects(MeshPipelineKey::SCREEN_SPACE_SPECULAR_TRANSMISSION_RESERVED_BITS). However, a low quality transmission would make this false, since low’s MeshPipelineKey is configured like this:const SCREEN_SPACE_SPECULAR_TRANSMISSION_LOW = 0 << Self::SCREEN_SPACE_SPECULAR_TRANSMISSION_SHIFT_BITS;. So, a ScreenSpaceTransmission with Low Quality would break rendering (since another if-block merely checks that theScreenSpaceTransmissioncomponent exists)Making it so that the low transmission truly does not include the view_transmission_textures makes the transmission render not properly - the spheres disappear!
So, I think the proper fix here is to remove the gating around transmission textures.
Edit: Another potential fix is to change the condition of the
intersectsbut I’m not sure how to encode what we want unless we want to add another bit forScreenSpaceTransmissioncomponent exists essentially? Happy to close this PR if that is an acceptable direction.Testing
cargo run --example transmissionworks for all quality levels.