Renderer · interface

DecalProjectorOptions

Explained in Hello world.

interface DecalProjectorOptions extends DecalBox
import type { DecalProjectorOptions } from '@driftengine/core';

Properties

NameTypeDescription
colorreadonlyoptionalReadonlyVec3What the mark multiplies the surface by. White marks nothing; black is a hole.
opacityreadonlyoptionalnumberHow much of that colour lands, 0 to 1.
facingCosreadonlyoptionalnumberHow far from facing the projector a surface may be turned and still be marked, as a cosine.
More

The stretch this prevents is the classic failure of a projected decal. A wall standing edge-on to the projector occupies one pixel of depth per metre of wall, so a mark aimed at the floor smears the full depth of the box up it in a long streak. projectDecal has the same number for the same reason, and this one is read from the depth buffer's own derivatives rather than from a vertex normal.

softnessreadonlyoptionalnumberHow much of the mark's radius is edge, 0 for a hard ellipse and 1 for all falloff.