emissiveAlpha

Turns an rgb light value into a color with alpha, so glows composite over transparency.

emissiveAlpha(rgb: Expr, hint: string = 'emissive'): Expr

Import compose from shaders/std and use compose.emissiveAlpha.

Alpha is the brightest channel and the color is scaled up to match, so over black the layer looks exactly like the light it is, and over anything else like a translucent tint. Use it as the last step of a glow, spill or flare. Not for opaque bodies.

Parameters

NameTypeNotes
rgbExpr
hintstringOptional. Default 'emissive'.

Example

paint: (params) => compose.emissiveAlpha(math.mul(params.uniforms.color.member('rgb'), coverage))

See also

  • layers — Stacks colors into one, first entry at the back.
  • dithered — Adds a tiny amount of noise to a final color so long soft gradients show no banding.

Used by

Irradiance