M7.1: Classic 3D renderer, cameras, lights, 3D views and camera-tool commands

- render/three_d: camera eval (one/two-node, DOF), default 50mm comp camera,
  orthographic Front/Left/Top/Back/Right/Bottom + perspective Custom Views,
  orbit/pan/dolly rig math; lights (parallel/spot/point/ambient, falloff,
  cone feather) and material shading; per-pixel depth-sorted compositor for
  3D runs (exact intersections, perspective-correct sampling, blend modes,
  track mattes, motion blur), ray-cast planar shadows with transmission and
  diffusion, per-layer DOF blur. RenderOpts.view camera override.
- project: camera iris/highlight props, aperture per comp width, light
  orientation/rotations, two-node auto-orient defaults.
- engine: layer.newCamera/newLight with presets & settings,
  layer.cameraSettings/lightSettings (Layer Settings dispatches),
  view.set3DView + View > Switch 3D View items (F10/F11/F12), last/reset view,
  camera.orbit/pan/dolly, view.get3D; EditorState.views3d.
- demo: "3D Showcase" comp (camera move, key spot + ambient fill, shadows,
  DOF, intersecting planes, gridded floor).
- tests: projection, depth order, intersections, lighting, shadows, DOF,
  views, rig math; command undo/redo. Fix a few pre-existing clippy lints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-01 21:09:21 -04:00
co-authored by Claude Opus 5.5
parent dee16181fe
commit 76ac3f74f7
21 changed files with 2657 additions and 67 deletions
+5 -6
View File
@@ -10,6 +10,7 @@ pub mod eval;
pub mod masks;
pub mod shapes;
pub mod text;
pub mod three_d;
use std::sync::Arc;
@@ -46,11 +47,13 @@ pub struct RenderOpts {
pub guides: bool,
/// Draft quality: fewer motion-blur samples, bilinear only.
pub draft: bool,
/// 3D view camera override (viewer Front/Top/Custom views); None = the comp's active camera.
pub view: Option<three_d::CameraState>,
}
impl Default for RenderOpts {
fn default() -> Self {
RenderOpts { scale: 1.0, motion_blur: true, guides: false, draft: false }
RenderOpts { scale: 1.0, motion_blur: true, guides: false, draft: false, view: None }
}
}
@@ -98,11 +101,7 @@ impl<'a> Renderer<'a> {
while j < visible.len() && visible[j].is_3d() {
j += 1;
}
let mut run: Vec<(&Layer, f64)> = visible[i..j].iter().map(|l| (*l, ctx.layer_to_comp(l).1)).collect();
run.sort_by(|a, b| b.1.total_cmp(&a.1));
for (l, _) in run {
self.draw_layer(&ctx, l, &mut canvas);
}
three_d::compose::draw_run(self, &ctx, &visible[i..j], &mut canvas);
i = j;
} else {
self.draw_layer(&ctx, visible[i], &mut canvas);