Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions systems/post/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ pub mod outline;
/// A live scene's camera made before its first 3D part (MSAA off, as a 2D scene's is) multisamples once a frame brings
/// one, as a render's camera does from its load, which sees every frame's rows (#38: kept-mount's cube mounts at frame
/// 10 and had hard edges live). Not one whose row asks for a single-sampled frame (ssao, aa, outline, frame_looks,
/// passes: spawn_camera's rule), and not in preview.
/// passes: spawn_camera's rule), not in preview, and not a deferred camera (a ray-traced one): Bevy turns MSAA off
/// on those itself each frame and says so, so this turned it on again every frame, a warning a frame in a render's
/// log and the camera's pipelines made again for nothing.
pub fn msaa_for_3d(world: &mut World, has_3d: bool) {
if !has_3d || preview() {
return;
}
let cams: Vec<Entity> = world.query_filtered::<Entity, With<Camera3d>>().iter(world).collect();
for e in cams {
let single = world.resource::<FrameRows>().vals(e).is_none_or(|v| ["ssao", "aa", "outline", "frame_looks", "passes"].iter().any(|k| v.contains_key(*k)));
if !single && world.get::<Msaa>(e) == Some(&Msaa::Off) {
let deferred = world.entity(e).contains::<bevy::core_pipeline::prepass::DeferredPrepass>();
if !single && !deferred && world.get::<Msaa>(e) == Some(&Msaa::Off) {
world.entity_mut(e).insert(Msaa::default());
}
}
Expand Down
Loading