interiorRay
The line of sight through a shape: where it enters, how far it travels inside, and where it is at any depth.
interiorRay(
field: SurfaceField,
frame: SurfaceFrame,
opts: {origin: {x: Expr; y: Expr}; view?: Expr; shear?: number; lengthScale?: number},
): InteriorRay
Import volume from shaders/std and use volume.interiorRay.
Pass the material's field and frame, the point the ray enters at (origin, usually the shape's centred placement coordinates) and optionally the view ray. shear (default 1) sets how far deeper samples slide sideways along the view, which is what makes an interior read as deep rather than flat. lengthScale stretches or shortens the travel. On a 3D shape length is the real chord through it. On a flat shape it stands in for depth, growing toward the middle of the shape.
Parameters
| Name | Type | Notes |
|---|---|---|
field | SurfaceField | |
frame | SurfaceFrame | |
opts | {origin: {x: Expr; y: Expr}; view?: Expr; shear?: number; lengthScale?: number} |
Example
const ray = interiorRay(field, frame, {origin: interior, view, shear: 0.55})
Tip. Refract
originthrough the shell first (shellRefract) and the interior bends at the glass walls.
See also
volumeMarch— Walk a ray through the medium front to back, adding up what glows and what dims.parallaxPlane— A flat layer at a fixed depth inside the shape, like scenery seen through a window.turbulentMedium— A billowing cloud density at a point inside the shape.