Renderer · interface

FilmOptions

What a film should do beyond shimmering, which until now was nothing.

Explained in Hello world.

interface FilmOptions
import type { FilmOptions } from '@driftengine/core';

In depth

A wet street at night is defined by everything above it appearing twice, and sheen cannot supply that: it is an interference pattern, so raising it makes a road oilier rather than wetter. This is the other half, kept a separate number for exactly that reason.

Requires a planar reflection to have been rendered this frame for the plane the film lies on, which needs RenderQuality.planarReflections where the scene has no water to allocate one. Absent or zero means the pass behaves as it always did, so nothing that predates it moves.

New, and honestly reported: the plumbing is proven and the look is not. Measured on demo/nightStreet.ts held at frame 900, turning it from 0 to 1 changes 46,129 pixels and the largest change to any channel is 12 of 255, so it is present and it does not yet read as a mirror. The reason is believed to be the film's own coverage alpha, which scales the mirrored term along with everything else, and a camera angle that keeps the grazing weight small. That is a weighting to tune rather than a mechanism to find, and the rig is where to tune it: ?scene=7&model=car&hold=900&wet=1 against &wet=0. Do not assume it looks right because it compiles.

Properties

NameTypeDescription
reflectionStrengthreadonlyoptionalnumberHow much of the mirrored scene shows through, 0 to 1.
More

Weighted by the viewing angle on top of this, because that is what a reflection does: a wet surface underfoot shows almost nothing and the same surface down the street shows everything.

reflectionPlaneYreadonlyoptionalnumberThe plane the film lies on, defaulting to 0.
More

Only used to check it against the plane the reflection was rendered for, so a film on a different plane gets no mirror rather than somebody else's. A patch lifted a centimetre clear of the road still names the road's own height: the lift is to stop it fighting for the depth buffer, not a different plane to mirror across.

roughnessreadonlyoptionalnumberHow rough the film's own surface is, 0 to 1. Zero is a mirror, which is what this pass was.
More

A film had one finish before this and it was the wrong one for the commonest use: a wet road is water lying in aggregate, so the stone under it scatters the reflection into a smear. Without this, a patch of film over a textured surface met it at a hard rim with mirror on one side and stone on the other — and softening the patch's coverage does not touch it, because the alpha was never what the eye was reading there.

Displaces the reflection rather than blurring it. A rough surface scatters what it reflects rather than softening it, so a lamp becomes a streak and not a soft disc; it is also the only affordable choice, since the mirror has no mip chain and an honest blur costs taps.

roughnessCyclesPerMetrereadonlyoptionalnumberHow coarse that roughness is, in bumps per metre. Defaults to 60.
More

The same quantity setSurfaceRelief takes, and matching the two is the point: given the same field at the same scale, the water is broken up by the aggregate the dry surface beside it is already showing, and the wet and the dry stop reading as two materials. Ignored when roughness is zero.