Renderer · function

ggxMaxLevelFor

The coarsest level the GGX chain reaches, which is one below the irradiance level.

Explained in Hello world.

function ggxMaxLevelFor(edge: number): number
import { ggxMaxLevelFor } from '@driftengine/core';

Parameters

ParameterTypeDescription
edgenumber

In depth

This is uEnvironmentMaxLod, and it is what roughnessForLevel maps roughness 1 onto. For the default edge it is 4, so the roughest level is 16 texels across.

That is better at high roughness than the cube it replaces, not worse. A 128 cube's chain ends at one texel a face, which the lit pass's own comment complains about — "one texel a face and therefore one colour for every direction". What is given up is roughness granularity, five stops against eight, and the level blend interpolates between them exactly as the cube's mip filter did.