Class: ColorGradingUtil
Defined in: src/util/ColorGradingUtil.ts:13
CPU mirror of ColorGradingShader, plus helpers to author strip LUTs.
LUT layout (the common "256×16" strip, generalized): size slices side by side, each size×size. Inside a slice x = red, y = green (top row is green 0); the slice index is blue. Values are sRGB-encoded 8-bit.
Constructors
Constructor
new ColorGradingUtil():
ColorGradingUtil
Returns
ColorGradingUtil
Methods
neutral()
staticneutral():ColorGradingSetting
Defined in: src/util/ColorGradingUtil.ts:15
Settings that leave the image untouched.
Returns
whiteBalance()
staticwhiteBalance(temperature,tint):RGB
Defined in: src/util/ColorGradingUtil.ts:20
Per-channel multipliers for a temperature / tint pair.
Parameters
temperature
number
tint
number
Returns
RGB
apply()
staticapply(rgb,s):RGB
Defined in: src/util/ColorGradingUtil.ts:25
Apply the parametric grade (everything except the LUT) to a linear display-referred color.
Parameters
rgb
RGB
s
Returns
RGB
createLUTData()
staticcreateLUTData(size?,fn?):object
Defined in: src/util/ColorGradingUtil.ts:44
Build the RGBA8 pixels of a strip LUT from a function on sRGB-encoded colors in [0,1]. fn defaults to identity (a neutral LUT).
Parameters
size?
number = 16
fn?
(r, g, b) => RGB
Returns
object
{ data, width: size*size, height: size }
data
data:
Uint8Array
width
width:
number
height
height:
number
sampleLUT()
staticsampleLUT(lut,srgb):RGB
Defined in: src/util/ColorGradingUtil.ts:63
Trilinear lookup into strip-LUT pixels, sRGB-encoded in and out. Mirrors the shader.
Parameters
lut
data
Uint8Array
width
number
height
number
srgb
RGB
Returns
RGB
applyWithLUT()
staticapplyWithLUT(rgb,s,lut):RGB
Defined in: src/util/ColorGradingUtil.ts:78
Full CPU pipeline: parametric grade, then the LUT blended by lutIntensity. Linear in, linear out.
Parameters
rgb
RGB
s
lut
data
Uint8Array
width
number
height
number
Returns
RGB

