Files
shinyobjectz 2929ce6a04 Camera cuts: a camera that jumps drops its history, and motion blur skips the jump
A cut to another camera was marked (Shots, RR2), but one camera moved far
in one frame, as a game's respawn or teleport moves it, was not. Solari's
and MetalFX's history carried the last view into the new one for half a
second, steady's filter blended it in, and motion blur streaked every pixel
along the jump.

raea-sys-post cut.rs sets CameraCut on each 3D camera every frame. A jump is
a turn of more than half the field of view in one frame, a lens changed by
half or more, or a step ten times the camera's recent pace and longer than
ten near planes. A camera's first move after it appears or cuts opens a
shot and is no step cut, unless it was seen resting first (unmoved across
two consecutive film frames). So a shot that opens on a fast move keeps its
blur, and so does a frame drawn alone with --at: the engine loads that
frame's pose at frame 0, then steps from the frame before. On a cut,
Solari's reset is set (MetalFX's denoiser, its scaler and emit_taa follow
it), steady starts its history again, and the shutter draws nothing.

Measured (lightbench window.tsx at 736x981 under Solari, the live preset;
each frame after the cut against the new view settled; worst 1/8 tile):
- one camera jumping to a view it never saw: first three frames 0.50, 0.43,
  0.38 stops -> 0.17, 0.13, 0.12 (a reset by hand: 0.14, 0.13, 0.12)
- a 90-degree flick in 15 frames: unchanged (no cut), 0.11 stops at its end
- blur.tsx, a 3 m jump with blur on: the jump frame 70.8 levels off the
  sharp frame -> 0.0. A pan of 1.5 m a frame from frame 0 is still blurred
  from frame 1, and its --at frame matches the full render's
- the three shutter scores unchanged (0.002, 0.067/0.034, 0.044/0.044)

Steady's reset follows the same flag; no steady scene was cut here.
2026-11-22 09:15:58 -08:00

47 lines
2.4 KiB
Rust

//! The camera's passes after the scene is drawn, each a function of the frame: the lens (Fisheye, LensDistortion), motion
//! blur, Bevy's depth of field and effect stack patched to keep the frame's alpha, and ink outlines; and the camera row's
//! post-processing (the sky, bloom, fog, the grade, AO and anti-aliasing, volumetric fog) put on the camera frame by frame.
use std::collections::BTreeMap;
use bevy::prelude::*;
use raea_core_program::ir::V;
use raea_sys_frame::*;
use raea_sys_frame::bevy_api;
pub mod camera;
pub mod lens;
pub mod views;
pub mod motion_blur;
// raea's motion blur: the shutter's own (docs/raytracing.feature RT29)
pub mod shutter;
// a camera that jumps is a cut: history starts again, motion blur waits (docs/raytracing.feature RT31)
pub mod cut;
pub mod dof;
pub mod effect_stack;
pub mod outline;
// raea's temporal filter (docs/realism.feature LT12)
pub mod steady;
/// 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), 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. Nor one whose prepasses a pass reads single-sampled
/// (PrepassRead: --aov, RAEA_PASS): turned on under them, a game's --aov was refused at its third frame (#159).
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)));
let deferred = world.entity(e).contains::<bevy::core_pipeline::prepass::DeferredPrepass>();
let read = world.entity(e).contains::<raea_sys_compose::passes::PrepassRead>();
if !single && !deferred && !read && world.get::<Msaa>(e) == Some(&Msaa::Off) {
world.entity_mut(e).insert(Msaa::default());
}
}
}