Update post_processing example to not render UI with first pass camera (#6469)

# Objective

Make sure the post processing example won't render UI twice.

## Solution

Disable UI on the first pass camera with `UiCameraConfig`
This commit is contained in:
Jakub Arnold 2022-11-14 22:34:26 +00:00
parent dc09ee36e2
commit 4de4e54755

View File

@ -95,7 +95,8 @@ fn setup(
}); });
// Main camera, first to render // Main camera, first to render
commands.spawn(Camera3dBundle { commands.spawn((
Camera3dBundle {
camera_3d: Camera3d { camera_3d: Camera3d {
clear_color: ClearColorConfig::Custom(Color::WHITE), clear_color: ClearColorConfig::Custom(Color::WHITE),
..default() ..default()
@ -107,7 +108,11 @@ fn setup(
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0)) transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0))
.looking_at(Vec3::default(), Vec3::Y), .looking_at(Vec3::default(), Vec3::Y),
..default() ..default()
}); },
// Disable UI rendering for the first pass camera. This prevents double rendering of UI at
// the cost of rendering the UI without any post processing effects.
UiCameraConfig { show_ui: false },
));
// This specifies the layer used for the post processing camera, which will be attached to the post processing camera and 2d quad. // This specifies the layer used for the post processing camera, which will be attached to the post processing camera and 2d quad.
let post_processing_pass_layer = RenderLayers::layer((RenderLayers::TOTAL_LAYERS - 1) as u8); let post_processing_pass_layer = RenderLayers::layer((RenderLayers::TOTAL_LAYERS - 1) as u8);