M13.5: camera iris bokeh depth of field and focus-link commands

3D-1: Classic 3D depth of field renders the camera's Iris Shape (Fast
Rectangle box or Triangle…Decagon polygon), Iris Rotation, Roundness, Aspect
Ratio and Diffraction Fringe as a span-kernel gather blur, with Highlight
Gain/Threshold/Saturation boosting highlights first; tilted layers blur
progressively by per-pixel camera depth. Layer > Camera > Link Focus Distance
to Point of Interest / to Layer (expressions) and Set Focus Distance to Layer
replace the stubs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-02 23:35:03 -04:00
co-authored by Claude Opus 5.5
parent bbaee1fa0f
commit 85c645f337
11 changed files with 638 additions and 23 deletions
+18
View File
@@ -26,6 +26,12 @@ pub struct Dof {
pub aperture: f64,
/// Blur Level (1.0 = 100%).
pub blur_level: f64,
/// Iris Shape, Rotation, Roundness, Aspect Ratio and Diffraction Fringe.
#[serde(default)]
pub iris: super::bokeh::Iris,
/// Highlight Gain, Threshold and Saturation.
#[serde(default)]
pub highlight: super::bokeh::Highlight,
}
impl Dof {
@@ -294,6 +300,18 @@ pub fn layer_camera(ctx: &EvalCtx, cam: &Layer) -> CameraState {
focus: ctx.f(cam, g, "focusDistance", zoom),
aperture: ctx.f(cam, g, "aperture", default_aperture(w)).max(0.0),
blur_level: ctx.f(cam, g, "blurLevel", 100.0).max(0.0) / 100.0,
iris: super::bokeh::Iris {
sides: super::bokeh::Iris::sides_of_shape(ctx.e(cam, g, "irisShape")),
rotation: ctx.f(cam, g, "irisRotation", 0.0),
roundness: ctx.f(cam, g, "irisRoundness", 0.0) / 100.0,
aspect: ctx.f(cam, g, "irisAspectRatio", 1.0).max(0.01),
fringe: ctx.f(cam, g, "irisDiffractionFringe", 0.0).max(0.0) / 100.0,
},
highlight: super::bokeh::Highlight {
gain: ctx.f(cam, g, "highlightGain", 0.0).clamp(0.0, 100.0) / 100.0,
threshold: ctx.f(cam, g, "highlightThreshold", 255.0).clamp(0.0, 255.0) / 255.0,
saturation: ctx.f(cam, g, "highlightSaturation", 0.0).clamp(0.0, 100.0) / 100.0,
},
});
CameraState { view: basis_view(eye, fwd, down), eye, zoom, ortho: false, dof }
}