import { d } from '../index'; import { Expr, GpuFragmentParams } from '../../contract'; /** * Uniform keys the thin-film builder reads via `params.uniforms.`. `mode`/`colorSpace` are * ALSO read via `params.propValues` for compile-time branching. */ export interface ThinFilmEffectUniforms { center: unknown; scale: unknown; rotation: unknown; intensity: unknown; rimWidth: unknown; edgeSoftness: unknown; thickness: unknown; dispersion: unknown; saturation: unknown; hueShift: unknown; lightAngle: unknown; speed: unknown; mode: unknown; colorA: unknown; colorB: unknown; colorC: unknown; colorSpace: unknown; } export interface ThinFilmEffectOptions { /** Treat the field as a real 3D film thickness (−chord/2): interference phase follows the * actual optical path (contour fringes across the whole surface) and the rim intensity follows * the view angle so every edge shows iridescence. */ volumetric?: boolean; /** Cheap bilinear sampler for the finite-difference gradient taps (compute path). Falls back to * sdfSampler when absent (inline-march / WebGL paths), preserving prior behaviour. */ gradSampler?: (uv: Expr) => Expr; /** Sampler carries an analytic gradient in `.g/.b` of the centre tap (the volumetric grad * sampler) — skip the two finite-difference taps entirely. Wins over `gradSampler`. */ bakedGradients?: boolean; } /** * Boundary-normal rim + interference phase from the SDF field. Returns `vec2(phase, rim)`. `sdfRaw` * is the raw field value (÷scale → the depth-space sdf); `gradX`/`gradY` are the raw forward * differences. 2D rim: quadratic distance falloff `(1-depth)²`. Volumetric rim: grazing-incidence * `pow(1-cosView, exponent)` from the field-gradient slope. The phase adds a directional warm/cool * term (nDotL rotated by animTime) and a thickness term (2D depth vs continuous −chord). Pure — * CPU-golden-testable (all scalar ops). */ export declare const thinFilmShade: import('typegpu').TgpuFn<(sdfRaw: d.F32, scale: d.F32, gradX: d.F32, gradY: d.F32, edgeSoftness: d.F32, rimWidthUniform: d.F32, thickness: d.F32, dispersion: d.F32, hueShift: d.F32, lightAngle: d.F32, animTime: d.F32, volumetric: d.F32) => d.Vec2f>; /** * IQ cosine palette → smooth iridescent spectrum (oil-slick / anodised metal). `t = phase`. * `cos((phase + k)·2π)·0.5 + 0.5` per channel with the TRUNCATED thirds this effect has always * used (0.3333 / 0.6667) — passed as arguments to the shared `lighting.cosinePalette`, which * Holographic calls with exact thirds. Unifying them would move pixels in one of the two. Pure. */ export declare const thinFilmRainbow: import('typegpu').TgpuFn<(phase: d.F32) => d.Vec3f>; /** * Custom 3-colour cycle parameters from the phase: returns `vec3(si, gate12, gate01)` where `si` is * the in-segment blend factor and `gate12`/`gate01` are WGSL `step` gates selecting the active * segment (A→B→C→A). Pure — CPU-golden-testable. The colours themselves are mixed in the builder * with the compile-time-selected `mixColorsVariants[mode]`. */ export declare const thinFilmCustomParams: import('typegpu').TgpuFn<(phase: d.F32) => d.Vec3f>; /** * Final composite: blend a plain white rim ↔ the spectral colour by `saturation`, scale by the rim * mask + intensity, and set alpha to the (clamped) rim. Intensity is unclamped so the rim can blow * out via tone mapping. Returns STRAIGHT rgba. Pure — CPU-golden-testable. */ export declare const thinFilmCompose: import('typegpu').TgpuFn<(baseColor: d.Vec3f, rim: d.F32, intensity: d.F32, saturation: d.F32) => d.Vec4f>; /** * Apply the iridescent thin-film rim effect. Composition-time Expr builder — see the file header * for the notes. A transparent-interior generator (no child): RGB is the rim colour, alpha is the * band mask; composite over a shape with `screen` / `linearDodge`. * * @param params the fragment builder params (reads `uniforms`/`propValues`/`props`/`ctx`) * @param sdfSampler `(uvExpr) → vec4 Expr`: `.r` = signed distance (negative inside) * @param options `volumetric` build-time flag + an optional cheap `gradSampler` for the taps */ export declare function applyThinFilmEffect(params: GpuFragmentParams, sdfSampler: (uv: Expr) => Expr, options?: ThinFilmEffectOptions): Expr; //# sourceMappingURL=thinFilm.d.ts.map