-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
(fix) SSRPlugin: Don't reference default deferred lighting pass if it doesn't exist #16932
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
Merged
alice-i-cecile
merged 2 commits into
bevyengine:main
from
SweetBiz:fix/ssr-with-default-deferred-lighting-disabled
Dec 24, 2024
Merged
(fix) SSRPlugin: Don't reference default deferred lighting pass if it doesn't exist #16932
alice-i-cecile
merged 2 commits into
bevyengine:main
from
SweetBiz:fix/ssr-with-default-deferred-lighting-disabled
Dec 24, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
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
Contributor
Author
|
Did a force push to run rustfmt, had the IDE setup a bit wrong |
IceSentry
reviewed
Dec 22, 2024
IceSentry
approved these changes
Dec 22, 2024
kristoff3r
approved these changes
Dec 23, 2024
Contributor
Author
|
A current workaround for this issue is to simply re-use Bevy's |
BenjaminBrienen
approved these changes
Dec 24, 2024
BenjaminBrienen
approved these changes
Dec 24, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 24, 2024
This PR simply exposes Bevy PBR's `TONEMAPPING_LUT_TEXTURE_BINDING_INDEX` and `TONEMAPPING_LUT_SAMPLER_BINDING_INDEX`. # Objective Alongside #16932, this is the last required change to be able to replace Bevy's built-in deferred lighting pass with a custom one based on the original logic.
pcwalton
pushed a commit
to pcwalton/bevy
that referenced
this pull request
Dec 25, 2024
… doesn't exist (bevyengine#16932) Fixes a crash when using deferred rendering but disabling the default deferred lighting plugin. # The Issue The `ScreenSpaceReflectionsPlugin` references `NodePbr::DeferredLightingPass`, which hasn't been added when `PbrPlugin::add_default_deferred_lighting_plugin` is `false`. This yields the following crash: ``` thread 'main' panicked at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26: InvalidNode(DeferredLightingPass) stack backtrace: 0: rust_begin_unwind at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5 1: core::panicking::panic_fmt at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:74:14 2: bevy_render::render_graph::graph::RenderGraph::add_node_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26 3: <bevy_app::sub_app::SubApp as bevy_render::render_graph::app::RenderGraphApp>::add_render_graph_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/app.rs:66:13 4: <bevy_pbr::ssr::ScreenSpaceReflectionsPlugin as bevy_app::plugin::Plugin>::finish at /Users/marius/Documents/dev/bevy/crates/bevy_pbr/src/ssr/mod.rs:234:9 5: bevy_app::app::App::finish at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:255:13 6: bevy_winit::state::winit_runner at /Users/marius/Documents/dev/bevy/crates/bevy_winit/src/state.rs:859:9 7: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 8: core::ops::function::FnOnce::call_once{{vtable.shim}} at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 9: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2454:9 10: bevy_app::app::App::run at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:184:9 11: bevy_deferred_test::main at ./src/main.rs:9:5 12: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 ``` ### Minimal reproduction example: ```rust use bevy::core_pipeline::prepass::{DeferredPrepass, DepthPrepass}; use bevy::pbr::{DefaultOpaqueRendererMethod, PbrPlugin, ScreenSpaceReflections}; use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins.set(PbrPlugin { add_default_deferred_lighting_plugin: false, ..default() })) .add_systems(Startup, setup) .insert_resource(DefaultOpaqueRendererMethod::deferred()) .run(); } /// set up a camera fn setup( mut commands: Commands ) { // camera commands.spawn(( Camera3d::default(), Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), DepthPrepass, DeferredPrepass, ScreenSpaceReflections::default(), )); } ``` # 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.
pcwalton
pushed a commit
to pcwalton/bevy
that referenced
this pull request
Dec 25, 2024
This PR simply exposes Bevy PBR's `TONEMAPPING_LUT_TEXTURE_BINDING_INDEX` and `TONEMAPPING_LUT_SAMPLER_BINDING_INDEX`. # Objective Alongside bevyengine#16932, this is the last required change to be able to replace Bevy's built-in deferred lighting pass with a custom one based on the original logic.
mockersf
pushed a commit
that referenced
this pull request
Jan 3, 2025
… doesn't exist (#16932) Fixes a crash when using deferred rendering but disabling the default deferred lighting plugin. # The Issue The `ScreenSpaceReflectionsPlugin` references `NodePbr::DeferredLightingPass`, which hasn't been added when `PbrPlugin::add_default_deferred_lighting_plugin` is `false`. This yields the following crash: ``` thread 'main' panicked at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26: InvalidNode(DeferredLightingPass) stack backtrace: 0: rust_begin_unwind at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5 1: core::panicking::panic_fmt at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:74:14 2: bevy_render::render_graph::graph::RenderGraph::add_node_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26 3: <bevy_app::sub_app::SubApp as bevy_render::render_graph::app::RenderGraphApp>::add_render_graph_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/app.rs:66:13 4: <bevy_pbr::ssr::ScreenSpaceReflectionsPlugin as bevy_app::plugin::Plugin>::finish at /Users/marius/Documents/dev/bevy/crates/bevy_pbr/src/ssr/mod.rs:234:9 5: bevy_app::app::App::finish at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:255:13 6: bevy_winit::state::winit_runner at /Users/marius/Documents/dev/bevy/crates/bevy_winit/src/state.rs:859:9 7: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 8: core::ops::function::FnOnce::call_once{{vtable.shim}} at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 9: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2454:9 10: bevy_app::app::App::run at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:184:9 11: bevy_deferred_test::main at ./src/main.rs:9:5 12: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 ``` ### Minimal reproduction example: ```rust use bevy::core_pipeline::prepass::{DeferredPrepass, DepthPrepass}; use bevy::pbr::{DefaultOpaqueRendererMethod, PbrPlugin, ScreenSpaceReflections}; use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins.set(PbrPlugin { add_default_deferred_lighting_plugin: false, ..default() })) .add_systems(Startup, setup) .insert_resource(DefaultOpaqueRendererMethod::deferred()) .run(); } /// set up a camera fn setup( mut commands: Commands ) { // camera commands.spawn(( Camera3d::default(), Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), DepthPrepass, DeferredPrepass, ScreenSpaceReflections::default(), )); } ``` # 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.
mockersf
pushed a commit
that referenced
this pull request
Jan 3, 2025
This PR simply exposes Bevy PBR's `TONEMAPPING_LUT_TEXTURE_BINDING_INDEX` and `TONEMAPPING_LUT_SAMPLER_BINDING_INDEX`. # Objective Alongside #16932, this is the last required change to be able to replace Bevy's built-in deferred lighting pass with a custom one based on the original logic.
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Jan 6, 2025
… doesn't exist (bevyengine#16932) Fixes a crash when using deferred rendering but disabling the default deferred lighting plugin. # The Issue The `ScreenSpaceReflectionsPlugin` references `NodePbr::DeferredLightingPass`, which hasn't been added when `PbrPlugin::add_default_deferred_lighting_plugin` is `false`. This yields the following crash: ``` thread 'main' panicked at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26: InvalidNode(DeferredLightingPass) stack backtrace: 0: rust_begin_unwind at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5 1: core::panicking::panic_fmt at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:74:14 2: bevy_render::render_graph::graph::RenderGraph::add_node_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26 3: <bevy_app::sub_app::SubApp as bevy_render::render_graph::app::RenderGraphApp>::add_render_graph_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/app.rs:66:13 4: <bevy_pbr::ssr::ScreenSpaceReflectionsPlugin as bevy_app::plugin::Plugin>::finish at /Users/marius/Documents/dev/bevy/crates/bevy_pbr/src/ssr/mod.rs:234:9 5: bevy_app::app::App::finish at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:255:13 6: bevy_winit::state::winit_runner at /Users/marius/Documents/dev/bevy/crates/bevy_winit/src/state.rs:859:9 7: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 8: core::ops::function::FnOnce::call_once{{vtable.shim}} at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 9: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2454:9 10: bevy_app::app::App::run at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:184:9 11: bevy_deferred_test::main at ./src/main.rs:9:5 12: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 ``` ### Minimal reproduction example: ```rust use bevy::core_pipeline::prepass::{DeferredPrepass, DepthPrepass}; use bevy::pbr::{DefaultOpaqueRendererMethod, PbrPlugin, ScreenSpaceReflections}; use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins.set(PbrPlugin { add_default_deferred_lighting_plugin: false, ..default() })) .add_systems(Startup, setup) .insert_resource(DefaultOpaqueRendererMethod::deferred()) .run(); } /// set up a camera fn setup( mut commands: Commands ) { // camera commands.spawn(( Camera3d::default(), Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), DepthPrepass, DeferredPrepass, ScreenSpaceReflections::default(), )); } ``` # 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.
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Jan 6, 2025
This PR simply exposes Bevy PBR's `TONEMAPPING_LUT_TEXTURE_BINDING_INDEX` and `TONEMAPPING_LUT_SAMPLER_BINDING_INDEX`. # Objective Alongside bevyengine#16932, this is the last required change to be able to replace Bevy's built-in deferred lighting pass with a custom one based on the original logic.
mrchantey
pushed a commit
to mrchantey/bevy
that referenced
this pull request
Feb 4, 2025
… doesn't exist (bevyengine#16932) Fixes a crash when using deferred rendering but disabling the default deferred lighting plugin. # The Issue The `ScreenSpaceReflectionsPlugin` references `NodePbr::DeferredLightingPass`, which hasn't been added when `PbrPlugin::add_default_deferred_lighting_plugin` is `false`. This yields the following crash: ``` thread 'main' panicked at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26: InvalidNode(DeferredLightingPass) stack backtrace: 0: rust_begin_unwind at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5 1: core::panicking::panic_fmt at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:74:14 2: bevy_render::render_graph::graph::RenderGraph::add_node_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/graph.rs:155:26 3: <bevy_app::sub_app::SubApp as bevy_render::render_graph::app::RenderGraphApp>::add_render_graph_edges at /Users/marius/Documents/dev/bevy/crates/bevy_render/src/render_graph/app.rs:66:13 4: <bevy_pbr::ssr::ScreenSpaceReflectionsPlugin as bevy_app::plugin::Plugin>::finish at /Users/marius/Documents/dev/bevy/crates/bevy_pbr/src/ssr/mod.rs:234:9 5: bevy_app::app::App::finish at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:255:13 6: bevy_winit::state::winit_runner at /Users/marius/Documents/dev/bevy/crates/bevy_winit/src/state.rs:859:9 7: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 8: core::ops::function::FnOnce::call_once{{vtable.shim}} at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 9: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2454:9 10: bevy_app::app::App::run at /Users/marius/Documents/dev/bevy/crates/bevy_app/src/app.rs:184:9 11: bevy_deferred_test::main at ./src/main.rs:9:5 12: core::ops::function::FnOnce::call_once at /Users/marius/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5 ``` ### Minimal reproduction example: ```rust use bevy::core_pipeline::prepass::{DeferredPrepass, DepthPrepass}; use bevy::pbr::{DefaultOpaqueRendererMethod, PbrPlugin, ScreenSpaceReflections}; use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins.set(PbrPlugin { add_default_deferred_lighting_plugin: false, ..default() })) .add_systems(Startup, setup) .insert_resource(DefaultOpaqueRendererMethod::deferred()) .run(); } /// set up a camera fn setup( mut commands: Commands ) { // camera commands.spawn(( Camera3d::default(), Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), DepthPrepass, DeferredPrepass, ScreenSpaceReflections::default(), )); } ``` # 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.
mrchantey
pushed a commit
to mrchantey/bevy
that referenced
this pull request
Feb 4, 2025
This PR simply exposes Bevy PBR's `TONEMAPPING_LUT_TEXTURE_BINDING_INDEX` and `TONEMAPPING_LUT_SAMPLER_BINDING_INDEX`. # Objective Alongside bevyengine#16932, this is the last required change to be able to replace Bevy's built-in deferred lighting pass with a custom one based on the original logic.
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-Bug
An unexpected or incorrect behavior
D-Trivial
Nice and easy! A great choice to get started with Bevy
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes a crash when using deferred rendering but disabling the default deferred lighting plugin.
The Issue
The
ScreenSpaceReflectionsPluginreferencesNodePbr::DeferredLightingPass, which hasn't been added whenPbrPlugin::add_default_deferred_lighting_pluginisfalse.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::DeferredLightingPassas the label for your own custom lighting pass node.