import * as THREE from 'three/webgpu'; /** * Generates a mip-aware blue noise texture using the Hilbert R1 blue noise algorithm. * * **Overview** * Blue noise textures are essential for high-quality rendering techniques such as: * - **Dithering**: Reducing quantization artifacts in gradients. * - **Stochastic Sampling**: Monte Carlo integration, soft shadows, and ambient occlusion. * - **Temporal Anti-Aliasing (TAA)**: Providing stable, high-frequency noise that integrates well over time. * * **Features** * - **Mip-Awareness**: Generates noise that remains blue (high-frequency) across mip levels, preventing aliasing artifacts when the texture is minified. * - **Hilbert R1 Algorithm**: Uses a low-discrepancy sequence mapped to a Hilbert curve for optimal spatial distribution. * - **GPU Generation**: Fully computed on the GPU for fast initialization. * * @example * import { ComputeMipAwareBlueNoise } from 'three-blocks/experimental/core-tsl-effects'; * * // Create generator * const blueNoiseGen = new ComputeMipAwareBlueNoise(512, 512); * * // Generate texture (async GPU operation) * const blueNoiseTexture = await blueNoiseGen.init(renderer); * * // Use in a material * const material = new THREE.MeshBasicNodeMaterial(); * material.colorNode = texture(blueNoiseTexture, uv().mul(10)); * * @class ComputeMipAwareBlueNoise * @short GPU generator for mip-aware Hilbert R1 blue-noise textures that stay blue across mips. * @category Compute * @tags WebGPU */ export declare class ComputeMipAwareBlueNoise { width: number; height: number; mipScaleExponent: number; storageTexture: THREE.StorageTexture | null; /** * Create a new mip-aware blue noise generator. * * @param {number} [width=128] - Width of the texture in pixels. * @param {number} [height=128] - Height of the texture in pixels. * @param {number} [mipScaleExponent=1.0] - Controls the scaling of noise coordinates across mip levels. * - `1.0`: Standard scaling (doubles frequency per level). * - `0.5`: Slower scaling, preserving larger structures. */ constructor(width?: number, height?: number, mipScaleExponent?: number); /** * Initializes and generates the blue noise texture using compute shaders. * This method must be called before using the texture. * * @param {THREE.WebGPURenderer} renderer - The WebGPU renderer instance used for computation. * @returns {THREE.StorageTexture} The generated storage texture. */ init(renderer: THREE.WebGPURenderer): THREE.StorageTexture; /** * Returns the generated blue noise texture. * * @returns {THREE.StorageTexture | null} The generated texture, or null if `init()` has not been called. */ getTexture(): THREE.StorageTexture | null; }