import { Expr, GpuFragmentParams } from '../../gpu/contract'; /** * One entry in `layers`: a color, or a color with options. * * `blend` is `'add'` (the default, sums light) or `'screen'` (brightens without blowing out). * `opacity` scales the layer. `behind` is a 0–1 factor the layer is seen through, such as the * transmittance of fog in front of it. */ export type Layer = Expr | { paint: Expr; /** `'add'` (default) sums light; `'screen'` folds it in with 1−(1−a)(1−b). */ blend?: 'add' | 'screen'; /** Scales the layer's contribution. */ opacity?: Expr | number; /** A 0–1 factor the layer is seen through (content behind a medium). */ behind?: Expr; }; /** * Builds N variations of one thing from a data list and sums them with weights. * * Give it a list of plain data and a function that turns one entry into `{value, weight}`. * You get `weightedSum` and `totalWeight` back and choose the blend yourself, usually * `weightedSum / (totalWeight + 0.001)`. Slice the list to change how many layers are built. * * @example * ```ts * const {weightedSum, totalWeight} = layered(CURTAINS.slice(0, count), ({offset, weight}) => ({value: curtain(offset), weight: math.mul(alpha, weight)})) * ``` * @tip Cheap depth: aurora curtains, cloud banks, echo trails are all a few layers of one recipe. * @see layers */ export declare function layered(layerData: readonly T[], build: (layer: T, index: number) => { value: Expr; weight: Expr; }): { weightedSum: Expr; totalWeight: Expr; }; /** * Stacks colors into one, first entry at the back. * * Each entry is a color, or `{paint, blend, opacity, behind}` (see `Layer`). Entries add * together unless one asks for `'screen'`. Needs at least one entry. * * @example * ```ts * const rgb = layers([ * {paint: sky, opacity: 0.6}, * {paint: stars, behind: fog.transmittance}, * {paint: glow, blend: 'screen'}, * ]) * ``` * @see layered, emissiveAlpha */ export declare function layers(entries: Layer[]): Expr; /** * Turns an rgb light value into a color with alpha, so glows composite over transparency. * * 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. * * @example * ```ts * paint: (params) => compose.emissiveAlpha(math.mul(params.uniforms.color.member('rgb'), coverage)) * ``` * @see layers, dithered */ export declare function emissiveAlpha(rgb: Expr, hint?: string): Expr; /** * Adds a tiny amount of noise to a final color so long soft gradients show no banding. * * Apply it to the finished rgba, never to a value that still feeds a palette. * * @example * ```ts * paint: (params) => dithered(standardPalette(field, params), params) * ``` * @see emissiveAlpha */ export declare function dithered(color: Expr, params: GpuFragmentParams): Expr; //# sourceMappingURL=compose.d.ts.map