import { type Disposable, KernelSize, Pass } from 'postprocessing'; import * as THREE from 'three'; export declare enum GodraysUpsampleQuality { /** * 2x2 neighborhood (4 texture taps). Fast with good edge preservation. */ LOW = 0, /** * 4x4 neighborhood (16 texture taps). Better quality, especially for diagonal edges. */ HIGH = 1 } export interface GodraysBlurParams { /** * The sigma factor used by the bilateral filter for the blur. Higher values result in more blur, but * can cause artifacts. * * Default: 0.1 */ variance: number; /** * The kernel size for the bilateral filter. Higher values blur more neighboring pixels and can smooth over higher amounts of noise, * but require exponentially more texture samples and thus can be slower. * * Default: `KernelSize.SMALL` */ kernelSize: KernelSize; } export interface AdaptiveStepsParams { stepSize: number; minSteps?: number; maxSteps?: number; } export interface GodraysPassParams { /** * The rate of accumulation for the godrays. Higher values roughly equate to more humid air/denser fog. * * Default: 1 / 128 */ density: number; /** * The maximum density of the godrays. Limits the maximum brightness of the godrays. * * Default: 0.5 */ maxDensity: number; /** * Higher values decrease the accumulation of godrays the further away they are from the light source. * * Default: 2 */ distanceAttenuation: number; /** * The color of the godrays. * * Default: `new THREE.Color(0xffffff)` */ color: THREE.Color; /** * The number of raymarching steps to take per pixel. Higher values increase the quality of the godrays at the cost of performance. * * Default: 60 */ raymarchSteps: number; /** * Whether or not to apply a bilateral blur to the godrays. This can be used to reduce artifacts that can occur when using a low number of raymarching steps. * * It costs a bit of extra performance, but can allow for a lower number of raymarching steps to be used with similar quality. * * Default: true */ blur: boolean | Partial; gammaCorrection: boolean; /** * Resolution scale for the godrays render target, relative to the full screen resolution. * Lower values improve performance at the cost of quality. The joint bilateral upsampling * preserves sharp edges even at low resolutions. * * - `1.0` — Full resolution. Best quality, highest cost. * - `0.5` — Half resolution (default). Good balance of quality and performance. * - `0.25` — Quarter resolution. Fast, but may lose fine detail. * * Default: `0.5` */ resolutionScale: number; /** * Quality level for the depth-aware upsampling of the low-resolution godrays texture. * * Uses joint bilateral upsampling (JBU) to prevent godrays from bleeding across depth edges. * Higher quality uses a larger sample neighborhood for smoother results, especially along diagonal edges. * * - `GodraysUpsampleQuality.LOW` — 2x2 neighborhood (4 texture taps). Fast with good edge preservation. * - `GodraysUpsampleQuality.HIGH` — 4x4 neighborhood (16 texture taps). Better quality. * * Default: `GodraysUpsampleQuality.HIGH` */ upsampleQuality: GodraysUpsampleQuality; /** * Adaptive step count based on ray length / step size. Uses per-pixel step count with shadow map texel size * as an additional floor. * * Cannot be used together with an explicit `raymarchSteps` value. */ adaptiveSteps?: AdaptiveStepsParams; /** * When enabled, renders a heatmap of raymarching step counts instead of godrays. * Uses a fixed scale of 0–150 steps so that comparisons between configurations are absolute. * * Implemented via a shader define, so there is zero runtime cost when disabled. * * Default: false */ debugSteps?: boolean; } export declare class GodraysPass extends Pass implements Disposable { private props; private depthTexture; private depthPacking; private lastParams; private lastWidth; private lastHeight; private godraysRenderTarget; private illumPass; private enableBlurPass; private blurPass; private blurRenderTarget; private compositorPass; /** * Constructs a new GodraysPass. Casts godrays from a point light source. Add to your scene's composer like this: * * ```ts * import { EffectComposer, RenderPass } from 'postprocessing'; * import { GodraysPass } from 'three-good-godrays'; * * const composer = new EffectComposer(renderer, { frameBufferType: THREE.HalfFloatType }); * const renderPass = new RenderPass(scene, camera); * renderPass.renderToScreen = false; * composer.addPass(renderPass); * * const godraysPass = new GodraysPass(pointLight, camera); * godraysPass.renderToScreen = true; * composer.addPass(godraysPass); * * function animate() { * composer.render(scene, camera); * } * ``` * * @param light The light source to use for the godrays. * @param camera The camera used to render the scene. * @param partialParams The parameters to use for the godrays effect. Will use default values for any parameters not specified. */ constructor(light: THREE.PointLight | THREE.DirectionalLight, camera: THREE.PerspectiveCamera, partialParams?: Partial); /** * Updates the parameters used for the godrays effect. Will use default values for any parameters not specified. */ setParams(partialParams: Partial): void; private maybeInitBlur; render(renderer: THREE.WebGLRenderer, inputBuffer: THREE.WebGLRenderTarget, outputBuffer: THREE.WebGLRenderTarget, _deltaTime?: number | undefined, _stencilTest?: boolean | undefined): void; setDepthTexture(depthTexture: THREE.Texture, depthPacking?: THREE.DepthPackingStrategies | undefined): void; setSize(width: number, height: number): void; dispose(): void; }