-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
(fix) SSRPlugin: Don't reference default deferred lighting pass if it doesn't exist #16932
base: main
Are you sure you want to change the base?
(fix) SSRPlugin: Don't reference default deferred lighting pass if it doesn't exist #16932
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
059f47b
to
6526c8a
Compare
Fixes a crash when using DefaultPlugins with `PbrPlugin { add_default_deferred_lighting_plugin: false, ..default() }`
6526c8a
to
3ad3b1d
Compare
Did a force push to run rustfmt, had the IDE setup a bit wrong |
crates/bevy_pbr/src/ssr/mod.rs
Outdated
let has_default_deferred_lighting_pass = render_app | ||
.world_mut() | ||
.get_resource_mut::<RenderGraph>() | ||
.unwrap() |
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.
This should essentially never be reached, but I'd prefer if this used expect with an error message. Alternatively, just use .resource_mut
which should already panic with a decent error message
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.
Used resource_mut
, I agree that that is the more idiomatic approach
A current workaround for this issue is to simply re-use Bevy's |
Fixes a crash when using deferred rendering but disabling the default deferred lighting plugin.
The Issue
The
ScreenSpaceReflectionsPlugin
referencesNodePbr::DeferredLightingPass
, which hasn't been added whenPbrPlugin::add_default_deferred_lighting_plugin
isfalse
.This yields the following crash:
Minimal reproduction example:
The Fix
When no node under the default lighting node's label exists, this label isn't added to the SSR's graph node edges. It's good to keep the SSRPlugin enabled, this way, users can plug in their own lighting system, which I have successfully done on top of this PR.
Workarounds
A current workaround for this issue is to re-use Bevy's
NodePbr::DeferredLightingPass
as the label for your own custom lighting pass node.