/** * StudioComposer -- postprocessing pipeline for Studio mode. * * Wraps the pmndrs EffectComposer to provide: * - Scene rendering (RenderPass) * - Screen-space ambient occlusion (N8AOPostPass) * - Screen-space shadow mask (BasicShadowMap + KawaseBlurPass) * - Tone mapping + sRGB output + antialiasing (ToneMappingEffect + SMAAEffect) * * Tone mapping is handled by the postprocessing ToneMappingEffect, which uses * Three.js's own GLSL tone mapping functions (via #include ). * The renderer's toneMapping must be set to NoToneMapping (the postprocessing * library's documented requirement). Exposure is controlled via * renderer.toneMappingExposure, which the GLSL functions read automatically. * * Background protection: solid-color backgrounds are excluded from tone mapping. * The RenderPass skips the background (ignoreBackground), the FBO is cleared to * transparent, and the EffectPass alpha-blends its output onto a pre-cleared * canvas that already has the correct background color. * * Shadow mask: BasicShadowMap produces sharp shadow boundaries at 4096×4096. * A half-resolution ShadowMaterial override pass captures the mask, which is * then blurred via KawaseBlurPass and composited by ShadowMaskEffect before * tone mapping. The floor keeps its own ShadowMaterial reading the shadow map * directly (sharp but clean). * * Only instantiated when Studio mode is active. Non-Studio rendering * bypasses this entirely and uses direct `renderer.render()`. */ import * as THREE from "three"; import type { StudioToneMapping } from "../core/types.js"; declare class StudioComposer { private _composer; private _renderPass; private _n8aoPass; private _toneMappingEffect; private _effectPass; private _renderer; private _scene; private _camera; /** Solid background color to protect from tone mapping, or null. */ private _bgProtectColor; private _shadowMaskRT; private _blurredObjectMaskRT; private _blurredFloorMaskRT; private _blurPass; private _shadowMaskMaterial; private _shadowMaskEffect; private _shadowMaskEnabled; private _width; private _height; private _receiveShadowState; private _savedIntensities; private _savedVisibility; /** * Create the postprocessing pipeline. * * @param renderer - WebGL renderer * @param scene - Scene to render * @param camera - Active camera (perspective or orthographic) * @param width - Canvas width in pixels * @param height - Canvas height in pixels */ constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, onSmaaReady?: () => void); /** * Enable or disable solid-background protection. * * When a solid color is set, the RenderPass skips the scene background * (ignoreBackground=true), the FBO is cleared to transparent, and the * canvas is pre-cleared with the correct color. The EffectPass then * alpha-blends its output so background pixels (alpha=0) show the * canvas clear color underneath. * * Pass null to disable protection (for gradient/environment backgrounds). */ setBackgroundProtect(color: THREE.Color | null): void; setAOEnabled(flag: boolean): void; setAOIntensity(value: number): void; /** * Set the tone mapping algorithm and exposure. * * @param mode - One of "neutral", "ACES", "none" * @param exposure - Exposure multiplier (0 to 2, default 1.0) */ setToneMapping(mode: StudioToneMapping, exposure: number): void; /** * Enable or disable the screen-space shadow mask pipeline. * * When enabled, creates half-resolution render targets and a KawaseBlurPass. * When disabled, disposes those resources and disables the mask effect. */ setShadowMaskEnabled(enabled: boolean): void; /** * Set shadow blur softness. Uses a fixed HUGE kernel with continuous scale. * * @param softness - 0 (sharpest) to 1 (softest) */ setShadowSoftness(softness: number): void; /** * Set the intensity of the object shadow mask overlay. * * @param intensity - 0 (no shadow) to 1 (full shadow) */ setShadowMaskIntensity(intensity: number): void; setCamera(camera: THREE.Camera): void; setSize(width: number, height: number): void; /** * Render one frame through the postprocessing pipeline. * * When shadow mask is enabled, runs a 3-phase pipeline: * 1. Render shadow mask (ShadowMaterial override) to half-res RT * 2. Blur via KawaseBlurPass * 3. Composite via ShadowMaskEffect in the main EffectPass * * When background protection is active, pre-clears the canvas with the * solid background color before compositing the tone-mapped scene on top * via alpha blending. */ render(deltaTime?: number): void; /** * Render a shadow mask to the half-resolution render target. * * @param mode - "objects" renders only objects (floor hidden), * "floor" renders only the floor (objects hidden) * @internal */ private _renderShadowMask; dispose(): void; } export { StudioComposer };