Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

A deferred camera's MSAA is left off: msaa_for_3d turned it on again each frame, Bevy turned it off and warned, once a frame in every ray-traced render's log

shinyobjectz4e252226a6bd
diff --git a/systems/post/src/lib.rs b/systems/post/src/lib.rs
index 7c460464..467505c4 100644
--- a/systems/post/src/lib.rs
+++ b/systems/post/src/lib.rs
@@ -20,7 +20,9 @@ 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;
@@ -28,7 +30,8 @@ pub fn msaa_for_3d(world: &mut World, has_3d: bool) {
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());
}
}