Renderer · function

roughnessForLevel

The roughness mip level level is convolved for.

Explained in Hello world.

function roughnessForLevel(level: number, maxLevel: number): number
import { roughnessForLevel } from '@driftengine/core';

Parameters

ParameterTypeDescription
levelnumber
maxLevelnumber

In depth

Linear in the level index, and it has to be, because the lit pass already picks its level with surfaceRoughness * uEnvironmentMaxLod. This is that relation read backwards. A different curve here would not be an improvement in isolation — it would be the two halves disagreeing about what level three means, which reads as roughness being subtly miscalibrated everywhere and points at nothing.

What would make it wrong is the lit pass changing how it selects a level; the two move together or neither moves.