material is a discriminated union on shader. Each model accepts only its own
options. All accept roughness and roughnessScale. Every numeric option takes
a plain number, a PhotonValue, or a callable signal.
shader: 'glass' moves the shape to its own pipeline. Instead of lighting a
surface it refracts the frame — Glass walks the ten
stages. The options are listed here in the order the shader uses them.
Index of refraction. The ray bends by 1/ior entering and by ior leaving; values below 1.0001 are clamped. Also sets the base reflectance metalness uses.
thickness
0.3
World units the exit ray travels before the backdrop is read — the lever on how far the image shifts. 0.3–0.6 reads as glass, 1–3 as a lens.
refraction
'volume'
'volume' bends at the front, walks the shape’s real depth to the back surface and bends again there. 'slab' bends once and walks thickness from the front — three.js’s model: thin edges bend as hard as the middle, the back surface plays no part, and thickness is a plain distance.
innerSteps
12
Steps of the inner march that finds the exit surface, clamped to 1–40. A sphere ignores it: its exit is solved exactly.
chromaticAberration
0
Fraction of the refraction offset by which red and blue are read on either side of green.
roughness
0
Blur of the refracted image: 0–1 picks mip 0–5 of the background copy. Stored as a byte.
anisotropy
0
Smears the read along a direction — five taps weighted 1·4·6·4·1, spaced 0.015 × anisotropy in screen space — and raises the mip.
anisotropyRotation
0
The smear direction in radians; 0 is horizontal.
anisotropyBlur
0
Extra mip bias on the smear so it reads as a streak rather than five copies. Counts as blur even with anisotropy at 0.
distortion
0
Warps the read position with a noise field; full amplitude moves it by 0.05 of the screen.
distortionScale
1
Frequency of that noise, in world units.
temporalDistortion
0
Drifts the noise with scene time so the warp animates. Inert unless distortion is above 0.
The colour assumed behind pixels where the canvas is transparent — the page. The canvas is premultiplied, so a refracted read of an empty pixel is composited over this.
attenuationDistance
1e6
Beer–Lambert: light that travels this far through the glass arrives as attenuationColor. The default is clear.
attenuationColor
#ffffff
The colour after attenuationDistance of travel. White is clear; the tint deepens with the path length through the volume.
Screen-space reflection of the shape pre-pass along the mirrored ray. Needs enableReflection on <Scene> — the flag multiplies the strength, so without it the option is inert. Mirrors other SDF shapes only, never particles, text or the mesh, and only a shape nearer than the glass surface: one behind or inside the glass refracts but does not reflect.
reflectionRoughness
0
Mip bias on that read, 0–5, from the shape mip chain.
gloss
0
A procedural studio environment — sky, ground, two bulbs — read along the reflected direction. Needs no scene flag.
Modifiers, at a sphere’s exit. Glass takes modifiers like any shape and
its surface march follows them, but under refraction: 'volume' a sphere’s
exit is solved from its bare radius.
<Effect> outline and glow. Their slots hold attenuation and distortion
on a glass shape; only the outline thickness survives, as envelope padding.
<Fast>. A glass shape inside <Fast> is counted as fast and drawn by
the fast pipeline, which has no glass branch — it lights as lambert.
A glass <Mesh> takes the same set plus four silhouette options —
see Mesh › MeshMaterial.
roughness, anisotropy, anisotropyBlur and reflectionRoughness each
pull in a mip chain. Every other option is arithmetic in a shader already
running.