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:
		
							parent
							
								
									dc09ee36e2
								
							
						
					
					
						commit
						4de4e54755
					
				| @ -95,19 +95,24 @@ fn setup( | |||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     // Main camera, first to render
 |     // Main camera, first to render
 | ||||||
|     commands.spawn(Camera3dBundle { |     commands.spawn(( | ||||||
|         camera_3d: Camera3d { |         Camera3dBundle { | ||||||
|             clear_color: ClearColorConfig::Custom(Color::WHITE), |             camera_3d: Camera3d { | ||||||
|  |                 clear_color: ClearColorConfig::Custom(Color::WHITE), | ||||||
|  |                 ..default() | ||||||
|  |             }, | ||||||
|  |             camera: Camera { | ||||||
|  |                 target: RenderTarget::Image(image_handle.clone()), | ||||||
|  |                 ..default() | ||||||
|  |             }, | ||||||
|  |             transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0)) | ||||||
|  |                 .looking_at(Vec3::default(), Vec3::Y), | ||||||
|             ..default() |             ..default() | ||||||
|         }, |         }, | ||||||
|         camera: Camera { |         // Disable UI rendering for the first pass camera. This prevents double rendering of UI at
 | ||||||
|             target: RenderTarget::Image(image_handle.clone()), |         // the cost of rendering the UI without any post processing effects.
 | ||||||
|             ..default() |         UiCameraConfig { show_ui: false }, | ||||||
|         }, |     )); | ||||||
|         transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0)) |  | ||||||
|             .looking_at(Vec3::default(), Vec3::Y), |  | ||||||
|         ..default() |  | ||||||
|     }); |  | ||||||
| 
 | 
 | ||||||
|     // 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); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jakub Arnold
						Jakub Arnold