DriftTexture · function

srgbToLinear

The exact sRGB transfer function, piecewise, not the 2.2 power approximation.

Explained in DriftTexture.

function srgbToLinear(value: number): number
import { srgbToLinear } from '@driftengine/texture';

Parameters

ParameterTypeDescription
valuenumber

In depth

The approximation is within about two percent almost everywhere and wrong by more than that in the dark end, which in a texture pipeline is a colour shift nobody attributes to the right cause for weeks. The midpoint is the value that tells them apart: 0.5 linearises to 0.2140 exactly and to 0.2176 approximately.