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
+14
View File
@@ -110,6 +110,9 @@ pub struct EditorState {
pub snapping: bool,
/// Last applied effect id (Effect ▸ last effect).
pub last_effect: Option<String>,
/// Viewer 3D view per comp (Active Camera / Front / … / Custom View 3 and edited view cameras).
#[serde(default)]
pub views3d: std::collections::BTreeMap<ItemId, effectcraft_render::three_d::Views3D>,
}
/// Events for frontends (drained each frame).
@@ -299,6 +302,15 @@ impl Session {
std::mem::take(&mut self.events)
}
/// The 3D view camera of a comp's viewer (None = the active camera).
pub fn view_camera(&self, comp: ItemId) -> Option<effectcraft_render::three_d::CameraState> {
let c = self.project.comp(comp)?;
if !c.has_3d() {
return None;
}
self.state.views3d.get(&comp)?.override_camera(c.width as f64, c.height as f64)
}
/// Render a comp frame with the session's footage + expression hosts.
pub fn render(&self, comp: ItemId, t: Tick, opts: RenderOpts) -> Image {
let mut r = Renderer::new(&self.project, self.footage.as_ref(), opts);
@@ -324,6 +336,8 @@ impl Session {
#[cfg(test)]
mod tests;
#[cfg(test)]
mod tests_3d;
/// Font families available to text layers (bundled + scanned system fonts).
pub fn text_families() -> Vec<String> {