M9.13: Card Dance / Shatter / Card Wipe camera systems, lighting and material

- card3d: shared Camera System (Camera Position with rotations, X/Y position and
  Transform Order; Corner Pins with focal length; Comp Camera via EffectHost::comp_scene),
  Lighting (Distant / Point / First Comp Light, colour, position, depth, ambient) and
  Material (diffuse, specular, highlight sharpness).
- Shatter: Custom Shatter Map (+ White Tiles Fixed), Gradient group, Textures group
  (front/side/back modes and layers, colour, opacity) and extrusion side rendering.
- Card Wipe: true 3D cards, Back Layer as a layer parameter (old None/Self popup migrated),
  Flip Direction, Position / Rotation Jitter.
- Renderer supplies the comp camera and first light to effects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-03 02:59:10 -04:00
co-authored by Claude Opus 5.5
parent 396268496b
commit 0ed5c87b94
10 changed files with 1118 additions and 145 deletions
+16 -1
View File
@@ -10,6 +10,7 @@ pub mod audio_fx;
mod blur2;
mod blur3;
pub mod camera_tracker;
mod card3d;
pub mod catalog;
mod channel;
mod channel2;
@@ -60,6 +61,7 @@ pub mod warp_stab;
use std::collections::HashMap;
use std::sync::OnceLock;
pub use card3d::{CompLight, CompScene};
pub use color_fx::{HUESAT_CHANNELS, LEVELS_CHANNELS, exposure_settings, huesat_ranges_identity, levels_channel_ids, levels_channels_identity, levels_clip};
pub use color2::Curve;
use effectcraft_keyframe::Value;
@@ -260,6 +262,11 @@ pub trait EffectHost: Sync {
fn aux(&self) -> Option<std::sync::Arc<AuxChannels>> {
None
}
/// The composition's camera and first light relative to the effect's layer (Card
/// Dance / Shatter / Card Wipe's Comp Camera and First Comp Light). `None` when unknown.
fn comp_scene(&self) -> Option<CompScene> {
None
}
}
/// Extra context the renderer may supply (all optional; `Default` is "nothing known").
@@ -573,6 +580,11 @@ pub const PARAM_GROUPS: &[(&str, &str)] = &[
("xScale", "X Scale"),
("yScale", "Y Scale"),
("cameraPosition", "Camera Position"),
("cornerPins", "Corner Pins"),
("positionJitter", "Position Jitter"),
("rotationJitter", "Rotation Jitter"),
("textures", "Textures"),
("gradient", "Gradient"),
("cannon", "Cannon"),
("grid", "Grid"),
("layerExploder", "Layer Exploder"),
@@ -677,6 +689,8 @@ pub const TIME_DEPENDENT: &[&str] = &[
"ec.time.ccforcemotionblur",
"ec.time.ccwidetime",
"ec.time.pixelmotionblur",
// Card Wipe's position / rotation jitter moves with time.
"ec.transition.cardwipe",
// Temporal Smoothing reads neighbouring frames.
"ec.color.autolevels",
"ec.color.autocontrast",
@@ -711,7 +725,8 @@ pub fn apply(spec: &EffectSpec, ctx: &EffectCtx, buf: Buf) -> Buf {
#[cfg(test)]
pub(crate) fn run_fx(id: &str, vals: &[(&str, Value)], img: Image, time: f64, env: EffectEnv) -> Buf {
let s = find(id).unwrap_or_else(|| panic!("no effect {id}"));
let mut params = Params { values: s.params.iter().map(|p| (p.id.to_string(), p.default.clone())).collect() };
let size = [img.width as f64, img.height as f64];
let mut params = Params { values: s.params.iter().map(|p| (p.id.to_string(), default_value(p, size))).collect() };
for (k, v) in vals {
assert!(params.values.contains_key(*k), "{id}: unknown param {k}");
params.values.insert(k.to_string(), v.clone());