pub enum Optics {
LensFlare {
center: Point,
ghosts: u8,
threshold: f64,
intensity: f64,
tint: Color,
},
Lens {
distortion: f64,
chromatic: f64,
auto_fit: bool,
center: Option<Point>,
},
LensVignette {
angle_of_view: f64,
strength: f64,
roundness: f64,
},
Bokeh {
radius: f64,
shape: ApertureShape,
highlight_boost: f64,
},
RadialBlur {
center: Point,
strength: f64,
samples: u8,
decay: f64,
},
Anamorphic {
threshold: f64,
length: f64,
stretch: f64,
tint: Color,
intensity: f64,
},
Relight {
height_from: HeightFrom,
light_dir: [f64; 3],
color: Color,
ambient: f64,
specular: f64,
},
}Expand description
Opt-in spatial effects on a completed subtree.
Variants§
LensFlare
Mirrored bright-source ghosts plus a restrained radial halo.
Fields
Lens
Radial distortion and channel-dependent radial dispersion.
Fields
LensVignette
Physical cos^4 falloff.
Fields
Bokeh
Bounded aperture blur with highlight-weighted sampling. Small radii use fewer taps; see
Optics::bokeh_taps.
Fields
shape: ApertureShapeAperture footprint.
RadialBlur
Bounded sampling from each pixel toward a light source.
Fields
Anamorphic
Anamorphic horizontal streak: highlights above threshold are stretched along the
device X axis with a tinted Gaussian and added back to the source.
Fields
Relight
Sobel height normals, Lambert diffuse and Blinn-Phong specular.
Implementations§
Source§impl Optics
impl Optics
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
Validates bounded finite parameters before capture or device initialization.
Sourcepub fn device(&self, transform: Transform, scale: f64) -> Self
pub fn device(&self, transform: Transform, scale: f64) -> Self
Maps local positions/radii to conservative device-space parameters.
Sourcepub fn streak_sigmas(&self) -> Option<[f64; 2]>
pub fn streak_sigmas(&self) -> Option<[f64; 2]>
Horizontal and vertical Gaussian sigmas of an anamorphic streak.
Sourcepub fn bounds(&self, source: Rect) -> Rect
pub fn bounds(&self, source: Rect) -> Rect
Conservative output support; radial optics retain the original frame bounds.
Sourcepub fn bokeh_taps(radius: f64) -> u32
pub fn bokeh_taps(radius: f64) -> u32
Aperture taps used for a Bokeh radius: ceil(1.4 * radius^2) within 8..=64, so tap
spacing stays near 1.5 pixels until the 64-tap maximum. Non-finite radii use the maximum.