Renderer · interface

GlobalFieldInstance

Explained in Hello world.

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

Properties

NameTypeDescription
sourcereadonlyFieldSource
albedoreadonlyoptionalVec3What colour this instance's surface is, or white where it did not say.
More

On the instance rather than the source, because the same baked field is placed many times and two pillars cut from one mould may be painted differently. Optional so that every caller written before the trace needed a colour is unchanged.

transformreadonlyReadonlyMat4World from object.
More

Uniform scale only, and composeGlobalField refuses the rest rather than approximating. A distance is not preserved by a non-uniform scale: the factor to correct by depends on the direction to the nearest surface, which is exactly what a distance field does not record. An instance squashed on one axis and sampled anyway produces something that is a distance in no direction and looks like one in every slice.