Skip to content

Commit 369a760

Browse files
authored
Add StartMainPassPostProcessing node for ordering (#20939)
# Objective - Fixes #20923 - Supersedes #20931 ## Solution - Add a StartMainPassPostProcessing to order against ## Testing - bloom example
1 parent d3f9699 commit 369a760

File tree

9 files changed

+33
-9
lines changed

9 files changed

+33
-9
lines changed

crates/bevy_anti_alias/src/taa/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl Plugin for TemporalAntiAliasPlugin {
7373
.add_render_graph_edges(
7474
Core3d,
7575
(
76-
Node3d::EndMainPass,
76+
Node3d::StartMainPassPostProcessing,
7777
Node3d::MotionBlur, // Running before TAA reduces edge artifacts and noise
7878
Node3d::Taa,
7979
Node3d::Bloom,

crates/bevy_core_pipeline/src/core_2d/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub mod graph {
1919
MainTransparentPass,
2020
EndMainPass,
2121
Wireframe,
22+
StartMainPassPostProcessing,
2223
Bloom,
2324
PostProcessing,
2425
Tonemapping,
@@ -118,6 +119,7 @@ impl Plugin for Core2dPlugin {
118119
Node2d::MainTransparentPass,
119120
)
120121
.add_render_graph_node::<EmptyNode>(Core2d, Node2d::EndMainPass)
122+
.add_render_graph_node::<EmptyNode>(Core2d, Node2d::StartMainPassPostProcessing)
121123
.add_render_graph_node::<ViewNodeRunner<TonemappingNode>>(Core2d, Node2d::Tonemapping)
122124
.add_render_graph_node::<EmptyNode>(Core2d, Node2d::EndMainPassPostProcessing)
123125
.add_render_graph_node::<ViewNodeRunner<UpscalingNode>>(Core2d, Node2d::Upscaling)
@@ -128,6 +130,7 @@ impl Plugin for Core2dPlugin {
128130
Node2d::MainOpaquePass,
129131
Node2d::MainTransparentPass,
130132
Node2d::EndMainPass,
133+
Node2d::StartMainPassPostProcessing,
131134
Node2d::Tonemapping,
132135
Node2d::EndMainPassPostProcessing,
133136
Node2d::Upscaling,

crates/bevy_core_pipeline/src/core_3d/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub mod graph {
2828
MainTransparentPass,
2929
EndMainPass,
3030
Wireframe,
31+
StartMainPassPostProcessing,
3132
LateDownsampleDepth,
3233
MotionBlur,
3334
Taa,
@@ -213,6 +214,7 @@ impl Plugin for Core3dPlugin {
213214
Node3d::MainTransparentPass,
214215
)
215216
.add_render_graph_node::<EmptyNode>(Core3d, Node3d::EndMainPass)
217+
.add_render_graph_node::<EmptyNode>(Core3d, Node3d::StartMainPassPostProcessing)
216218
.add_render_graph_node::<ViewNodeRunner<TonemappingNode>>(Core3d, Node3d::Tonemapping)
217219
.add_render_graph_node::<EmptyNode>(Core3d, Node3d::EndMainPassPostProcessing)
218220
.add_render_graph_node::<ViewNodeRunner<UpscalingNode>>(Core3d, Node3d::Upscaling)
@@ -230,6 +232,7 @@ impl Plugin for Core3dPlugin {
230232
Node3d::MainTransmissivePass,
231233
Node3d::MainTransparentPass,
232234
Node3d::EndMainPass,
235+
Node3d::StartMainPassPostProcessing,
233236
Node3d::Tonemapping,
234237
Node3d::EndMainPassPostProcessing,
235238
Node3d::Upscaling,

crates/bevy_core_pipeline/src/experimental/mip_generation/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Plugin for MipGenerationPlugin {
9595
.add_render_graph_edges(
9696
Core3d,
9797
(
98-
Node3d::EndMainPass,
98+
Node3d::StartMainPassPostProcessing,
9999
Node3d::LateDownsampleDepth,
100100
Node3d::EndMainPassPostProcessing,
101101
),

crates/bevy_pbr/src/volumetric_fog/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,13 @@ impl Plugin for VolumetricFogPlugin {
102102
)
103103
.add_render_graph_edges(
104104
Core3d,
105-
// Volumetric fog is a postprocessing effect. Run it after the
106-
// main pass but before bloom.
107-
(Node3d::EndMainPass, NodePbr::VolumetricFog, Node3d::Bloom),
105+
// Volumetric fog should run after the main pass but before bloom, so
106+
// we order if at the start of post processing.
107+
(
108+
Node3d::EndMainPass,
109+
NodePbr::VolumetricFog,
110+
Node3d::StartMainPassPostProcessing,
111+
),
108112
);
109113
}
110114
}

crates/bevy_post_process/src/auto_exposure/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ impl Plugin for AutoExposurePlugin {
7575
.add_render_graph_node::<AutoExposureNode>(Core3d, node::AutoExposure)
7676
.add_render_graph_edges(
7777
Core3d,
78-
(Node3d::EndMainPass, node::AutoExposure, Node3d::Tonemapping),
78+
(
79+
Node3d::StartMainPassPostProcessing,
80+
node::AutoExposure,
81+
Node3d::Tonemapping,
82+
),
7983
);
8084
}
8185
}

crates/bevy_post_process/src/bloom/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,21 @@ impl Plugin for BloomPlugin {
8181
.add_render_graph_node::<ViewNodeRunner<BloomNode>>(Core3d, Node3d::Bloom)
8282
.add_render_graph_edges(
8383
Core3d,
84-
(Node3d::EndMainPass, Node3d::Bloom, Node3d::Tonemapping),
84+
(
85+
Node3d::StartMainPassPostProcessing,
86+
Node3d::Bloom,
87+
Node3d::Tonemapping,
88+
),
8589
)
8690
// Add bloom to the 2d render graph
8791
.add_render_graph_node::<ViewNodeRunner<BloomNode>>(Core2d, Node2d::Bloom)
8892
.add_render_graph_edges(
8993
Core2d,
90-
(Node2d::EndMainPass, Node2d::Bloom, Node2d::Tonemapping),
94+
(
95+
Node2d::StartMainPassPostProcessing,
96+
Node2d::Bloom,
97+
Node2d::Tonemapping,
98+
),
9199
);
92100
}
93101
}

crates/bevy_post_process/src/motion_blur/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Plugin for MotionBlurPlugin {
159159
.add_render_graph_edges(
160160
Core3d,
161161
(
162-
Node3d::EndMainPass,
162+
Node3d::StartMainPassPostProcessing,
163163
Node3d::MotionBlur,
164164
Node3d::Bloom, // we want blurred areas to bloom and tonemap properly.
165165
),

release-content/migration-guides/bevy_render_reorganization.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ They have now been given a new home in `bevy_anti_alias` and `bevy_post_process`
3939
If you were importing FxaaPlugin, SmaaPlugin, TemporalAntiAliasPlugin, or CasPlugin from `bevy_core_pipeline` or `bevy::core_pipeline`, you must now import them from `bevy_anti_alias` or `bevy::anti_alias`.
4040

4141
If you were importing Bloom, AutoExposure, ChromaticAberration, DepthOfField, or MotionBlur from `bevy_core_pipeline` or `bevy::core_pipeline`, you must now import them from `bevy_post_process` or `bevy::post_process`.
42+
43+
Additionally, you may now order rendering passes against the new `StartMainPassPostProcessing` node.

0 commit comments

Comments
 (0)