/** * ScreenSpaceEffects.ts * * Screen-space post-processing effects (CPU simulation / offline renderer): * - SSAO (Scalable Ambient Obscurance — hemispherical sampling) * - SSR (Screen-Space Reflections — linear ray march in projection) * - SSGI (Screen-Space Global Illumination — short-range bounce) * - TAA (Temporal Anti-Aliasing — history blend with jitter) * - Motion Blur (velocity-buffer blur) * - DOF (Depth of Field — circle-of-confusion + gather) * - Chromatic Aberration * - Film Grain * - Vignette * * All operations work on flat Float32Array pixel buffers (RGBA, linear). * No WebGPU / DOM — fully testable in Vitest. * * @module rendering */ export type PixelBuffer = Float32Array; export interface SSAOConfig { /** Number of hemisphere samples (default 16) */ samples: number; /** Sampling radius in world units */ radius: number; /** Depth bias to prevent self-occlusion */ bias: number; /** 0–1, power curve for occlusion accumulation */ power: number; } /** * Compute SSAO occlusion factor per pixel. * @param depth - Float32Array, R channel = linear depth (0–1) * @param normals - Float32Array, RGB = world-space normal XYZ * @returns Float32Array (R only), occlusion 0 (occluded) to 1 (clear) */ export declare function computeSSAO(depth: PixelBuffer, normals: PixelBuffer, width: number, height: number, config?: Partial): Float32Array; export interface SSRConfig { /** Max ray march steps */ steps: number; /** Step size in screen pixels */ stepSize: number; /** Max roughness threshold (rougher surfaces skip SSR) */ maxRoughness: number; /** Thickness (depth tolerance) */ thickness: number; } /** * Screen-space reflection mask: returns a Float32Array (0–1, R channel) * indicating reflection presence at each pixel, plus the reflected UV coords. */ export declare function computeSSR(color: PixelBuffer, depth: PixelBuffer, width: number, height: number, roughness: Float32Array, config?: Partial): { mask: Float32Array; uvs: Float32Array; }; export interface SSGIConfig { /** Sample count per pixel */ sampleCount: number; /** Sampling radius in pixels */ radius: number; /** Intensity multiplier */ intensity: number; } /** * Very short-range GI approximation: samples nearby pixels and * bleeds their colour onto the current pixel (one-bounce). * Returns a Float32Array (RGBA) indirect irradiance buffer. */ export declare function computeSSGI(color: PixelBuffer, depth: PixelBuffer, width: number, height: number, config?: Partial): PixelBuffer; export interface TAAConfig { /** Feedback (history blend) factor: 0 = no history, 1 = full history */ feedback: number; /** Halton jitter scale in screen pixels */ jitterScale: number; } /** Halton sequence (base 2, base 3 for xy jitter) */ export declare function haltonJitter(frameIndex: number): [number, number]; /** * Blend current frame with history buffer (TAA). * history is modified in-place with each call. */ export declare function blendTAA(current: PixelBuffer, history: PixelBuffer, width: number, height: number, config?: Partial): PixelBuffer; export interface MotionBlurConfig { /** Number of blur samples */ sampleCount: number; /** Max blur length in pixels */ maxLength: number; } /** * Apply motion blur using a velocity buffer. * @param velocity - Float32Array, RG = velocity XY in pixels/frame */ export declare function applyMotionBlur(color: PixelBuffer, velocity: PixelBuffer, width: number, height: number, config?: Partial): PixelBuffer; export interface DOFConfig { /** Focal depth (0–1 normalized) */ focalDepth: number; /** Focal range — depths within ±range of focalDepth are sharp */ focalRange: number; /** Max CoC radius in pixels */ maxRadiusPx: number; /** Sample count per pixel */ sampleCount: number; } /** Compute Circle of Confusion radius for a given depth value */ export declare function computeCoC(depth: number, config?: Partial): number; /** * Apply DOF using a disc gather (CPU approximate bokeh). */ export declare function applyDOF(color: PixelBuffer, depth: PixelBuffer, width: number, height: number, config?: Partial): PixelBuffer; export interface ChromaticAberrationConfig { /** Aberration offset in pixels at the screen edge */ strength: number; } /** * Chromatic aberration (RGB channel offset towards edges). */ export declare function applyChromaticAberration(color: PixelBuffer, width: number, height: number, config?: Partial & { strength?: number; }): PixelBuffer; /** * Add film grain noise. * @param intensity 0–1, grain strength * @param seed Deterministic seed for repeatable grain pattern */ export declare function applyFilmGrain(color: PixelBuffer, width: number, height: number, intensity: number, seed?: number): PixelBuffer; /** * Apply a radial vignette (darker at corners). * @param strength 0–1 * @param radius 0–1, the point where vignette begins */ export declare function applyVignette(color: PixelBuffer, width: number, height: number, strength: number, radius?: number): PixelBuffer; //# sourceMappingURL=ScreenSpaceEffects.d.ts.map