Renderer · function

placeCascade

Put one cascade where the camera is, and answer its half-extent.

Explained in Hello world.

function placeCascade(cascade: GlobalFieldCascade, level: number, radius: number, cameraPos: ReadonlyVec3): number
import { placeCascade } from '@driftengine/core';

Parameters

ParameterTypeDescription
cascadeGlobalFieldCascade
levelnumber
radiusnumber
cameraPosReadonlyVec3

In depth

Exported because the compute path needs the same placement and two spellings drift. A pass filling these on a device has to agree with this about where every cascade stands, to the last bit: disagree by a fraction of a step and the fade between cascades lands somewhere different on each side, which is a seam that appears only when both paths are compared.

The snapping is the decision. See composeGlobalField for why a grid centred on the exact camera position makes the whole field shimmer.