lutAtlasGrade

Grade a color through a measured 3D color lookup table (LUT), the film-stock look.

lutAtlasGrade(slots: {
    select: PropRef
    strength: PropRef
    size: number
    decode: (key: string) => Uint8Array
    fallback: string
    label: string
}): (color: Expr, params: FilterParams | GpuFragmentParams) => Expr

Import effects from shaders/std and use effects.color.lutAtlasGrade.

Returns a stage (color, params) => gradedColor for a gpu: fragment, not an effect:. select is a select prop declared compileTime: true that names the table; decode(key) returns that table's bytes as RGBA, size levels per channel laid out as size square slices side by side (red across, green down, one slice per blue level), sRGB in and out. fallback is the key used when the prop is unset. strength (0–1) fades the graded color over the original. Alpha kept; colors brighter than white grade as white.

Parameters

NameTypeNotes
slots`{
select: PropRef
strength: PropRef
size: number
decode: (key: string) => Uint8Array
fallback: string
label: string

}` | |

Example

const grade = lutAtlasGrade({select: p('stock'), strength: p('strength'), size: 17, decode: decodeStockLut, fallback: 'portrait400', label: 'film-lut'})
// then, inside the definition's gpu.fragment: grade(childColor, params)

Tip. Changing select rebuilds the shader; keep the table list short.

See also

  • tint — Wash the child toward one color.
  • gradientMap — Recolor the child by its brightness through a gradient, the Photoshop gradient map.

Used by

FilmStock