import type { TSLFloatInput, TSLFloatNode, TSLTextureNode, TSLVec2Node } from '../types/tsl.cjs'; export interface NarrowRangeFilterOptions { depthNode: TSLTextureNode; direction: readonly [x: number, y: number]; texelSize: TSLVec2Node; radius?: number | undefined; depthRange: TSLFloatInput; worldSigma?: TSLFloatInput | null | undefined; projectionScale?: TSLFloatInput | null | undefined; fillRadius?: number | undefined; sampleUV?: TSLVec2Node | undefined; } /** * Narrow-range depth filter for screen-space fluid surfaces * (Truong & Yuksel, *A Narrow-Range Filter for Screen-Space Fluid Rendering*, * I3D 2018), in its separable approximation. * * The filter smooths a linear fluid-depth buffer while preserving * silhouettes: neighbors farther than `depthRange` behind the center are * ignored (a different surface), neighbors in front are clamped into the * narrow range so foreground splats round the surface instead of eroding it. * Empty texels (depth `0`) never contribute; isolated pinholes inside the * surface are filled only when wet samples exist on both sides of the hole * and agree within the narrow range. The Gaussian sigma can be specified in * world units and is projected into texels independently at every pixel. * * Build one pass per axis and ping-pong between two render targets. Call it * inside an `Fn` body — the internal `Loop` attaches to the active TSL stack: * * This implementation-level API is intentionally internal and has no public package import. * * @short Separable narrow-range depth filter — the SSF silhouette-preserving smoothing pass. * @category TSL * @tags WebGPU, TSL, Water, SSF * * @tsl * @function * @param {NarrowRangeFilterOptions} options * @param {import('../types/tsl.js').TSLTextureNode} options.depthNode Texture node holding positive linear view depth (0 = empty). * @param {Readonly<[number, number]>} options.direction Filter axis: `[1,0]` or `[0,1]`. * @param {import('../types/tsl.js').TSLVec2Node} options.texelSize Inverse target size uniform. * @param {number} [options.radius=6] Half-width in texels (compile-time constant). * @param {import('../types/tsl.js').TSLFloatInput} options.depthRange Narrow-range threshold in view units. * @param {import('../types/tsl.js').TSLFloatInput|null} [options.worldSigma=null] Gaussian sigma in view/world units. * When provided with `projectionScale`, the per-pixel radius is * `clamp( worldSigma * projectionScale / viewDepth, 1, radius )`. * @param {import('../types/tsl.js').TSLFloatInput|null} [options.projectionScale=null] Projection scale in pixels * (`0.5 * targetHeight * projectionMatrix[1][1]`). * @param {number} [options.fillRadius=2] Empty texels with wet neighbors within this many * texels adopt the nearest neighbor depth — closes splat-coverage pinholes without * meaningfully growing the silhouette. `0` preserves empties exactly. * @param {import('../types/tsl.js').TSLVec2Node} [options.sampleUV] Sample coordinate; defaults to `uv()`. * @returns {import('../types/tsl.js').TSLFloatNode} Filtered positive view depth (0 where empty). */ export declare function narrowRangeFilter({ depthNode, direction, texelSize, radius, depthRange, worldSigma, projectionScale, fillRadius, sampleUV, }: NarrowRangeFilterOptions): TSLFloatNode;