Renderer · interface

DistanceFieldInstance

One placed field. transform is this queue's own copy; source is the consumer's object.

Explained in Hello world.

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

Properties

NameTypeDescription
sourceFieldSourceThe baked field. Shared by reference: it does not move and it is the large thing.
transformreadonlyFloat32ArrayWorld from object, copied at the moment it was declared. Uniform scale only.
albedoreadonlyFloat32ArrayWhat colour this placement's surface is, copied like the transform. White where none was given.
More

A ray that lands on a wall needs to know what colour it is, because what leaves a surface is the light arriving times its albedo — and a composed distance field is a union that has already forgotten which instance won. demo/dev/bounce.html is what made it necessary: a trace without it returned the same answer for a red wall and a white one.

On the placement rather than the field, because the same baked shape is placed many times and two pillars cut from one mould may be painted differently.