@ignifx/core 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { o as rebuildMaterialPipelines } from "./material-myMbl9mW.js";
2
- import { SCENE_INPUT_TASK_NAMES, frameGraphTasks } from "./scene-inputs-_0j2Hi6L.js";
2
+ import { SCENE_INPUT_TASK_NAMES, frameGraphTasks } from "./scene-inputs-CbTkrkOw.js";
3
3
  import { addComputeDispatch, addTaskAfter, buildFrameGraphTask, computeStorageTextureBinding, computeTextureBinding, computeUniformBufferBinding, createComputeBindingSet, createComputeDispatch, createComputeShader, createComputeStorageTexture2D, createComputeTask, createComputeTextureResource, createUniformBuffer, disposeComputeBindingSet, disposeComputeShader, disposeComputeStorageTexture2D, disposeUniformBuffer, getEffectiveAspectRatio, getFrameGraph, getPbrUnlit, getProjectionMatrix, getViewMatrix, invertMat4, isPbrMaterial, removeComputeDispatch, updateUniformBuffer } from "@babylonjs/lite";
4
4
  //#region src/lite/gpu/gtao.ts
5
5
  /**
@@ -626,4 +626,4 @@ function rebuildPatchedMaterials(scene, plugin) {
626
626
  //#endregion
627
627
  export { GTAO_PLUGIN_NAME, GTAO_TASK_NAMES, createAmbientOcclusion, createAmbientOcclusionPlugin, gtaoDenoiseWgsl, gtaoPluginWgsl, gtaoShape, gtaoWgsl };
628
628
 
629
- //# sourceMappingURL=gtao-BmdrXXJz.js.map
629
+ //# sourceMappingURL=gtao-CVAYWBEJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gtao-BmdrXXJz.js","names":[],"sources":["../src/lite/gpu/gtao.ts"],"sourcesContent":["import {\n addComputeDispatch,\n addTaskAfter,\n buildFrameGraphTask,\n computeTextureBinding,\n computeStorageTextureBinding,\n computeUniformBufferBinding,\n createComputeBindingSet,\n createComputeDispatch,\n createComputeShader,\n createComputeStorageTexture2D,\n createComputeTask,\n createComputeTextureResource,\n createUniformBuffer,\n disposeComputeBindingSet,\n disposeComputeShader,\n disposeComputeStorageTexture2D,\n disposeUniformBuffer,\n getEffectiveAspectRatio,\n getFrameGraph,\n getPbrUnlit,\n getProjectionMatrix,\n getViewMatrix,\n invertMat4,\n isPbrMaterial,\n removeComputeDispatch,\n updateUniformBuffer,\n} from \"@babylonjs/lite\";\nimport { rebuildMaterialPipelines } from \"../material.js\";\nimport { frameGraphTasks, SCENE_INPUT_TASK_NAMES } from \"./scene-inputs.js\";\nimport type { SceneInputs } from \"./scene-inputs.js\";\nimport type {\n ComputeDispatch,\n ComputeShader,\n ComputeStorageTexture2D,\n ComputeTask,\n EngineContext,\n Mat4,\n Material,\n MaterialPlugin,\n SceneContext,\n Task,\n UniformBuffer,\n} from \"@babylonjs/lite\";\n\n/**\n * Ground-truth ambient occlusion (`docs/architecture/07-rendering.md` §2.14). Its own chunk: the\n * renderer imports it only when `rendering.ambientOcclusion.enabled` is on, so a project without it\n * loads none of it and its frame graph has none of these tasks (`CONSTITUTION.md` §2.5).\n *\n * ```text\n * … depth pyramid → gtao params → gtao (compute: horizons, then depth-aware blur) → scene → …\n * └─ AO texture ─→ every lit PBR material's `occlusion`\n * ```\n *\n * - **GTAO** (Jimenez et al. 2016, after XeGTAO): per pixel, a few screen-space slices through the\n * view vector; along each, the highest horizon on either side within `radius`, then the cosine-\n * weighted visible arc between them against the normal projected into the slice. Depth comes from\n * the scene inputs' depth pyramid (level 1 at half resolution, coarser levels for far taps), normals\n * from the scene inputs' world normals, rotated into view space. Slice angle and step offset are\n * jittered per pixel with interleaved gradient noise.\n * - **Denoise.** A 5×5 blur weighted by view-depth similarity, in the same compute pass.\n * - **Indirect light only.** {@link createAmbientOcclusionPlugin} multiplies Lite's PBR\n * `occlusion` variable, which scales the environment's irradiance and specular occlusion and\n * nothing else (`lib/material/pbr/fragments/ibl-fragment.js`), by the AO texture at the\n * fragment's screen position. Every lit PBR variant declares `occlusion` before that slot: the\n * template's `occlusionDefault`, or the reflectance extension's own `AT` code\n * (`lib/material/pbr/fragments/reflectance-fragment.js` line 146). Standard materials, unlit PBR and\n * custom shaders are left alone.\n * - **Camera matrices** are written by a tiny task that runs inside the frame graph, after Lite has\n * updated world matrices for the frame, so the AO never lags a moving camera.\n * - **Resize and device loss.** The scene inputs' `onChange` disables the pass, rebuilds the\n * textures and bindings, swaps them in, and rebuilds the patched materials, whose bind groups hold\n * the AO texture's view. The old textures are disposed a few frames later, once no in-flight bind\n * group can still name them.\n * - **TAA.** `rendering.taa` filters the final colour, AO included; a dedicated AO history is\n * not wired. It would accumulate {@link AmbientOcclusion.texture} before the plugin reads it.\n */\n\n/**\n * The frame-graph task names, in the order they run after the scene inputs.\n *\n * @internal\n */\nexport const GTAO_TASK_NAMES = { params: \"ignifx:gtao-params\", compute: \"ignifx:gtao\" } as const;\n\n/**\n * The name the material plugin carries; part of Lite's pipeline cache key.\n *\n * @internal\n */\nexport const GTAO_PLUGIN_NAME = \"ignifx-gtao\";\n\n/** The uniform block: three matrices, the sizes, the settings. */\nconst UNIFORM_FLOATS = 16 * 3 + 4 + 4;\n\n/** Frames an old texture set outlives its replacement. */\nconst RETIRE_FRAMES = 8;\n\n/** The workgroup edge both shaders use. */\nconst WORKGROUP = 8;\n\n/**\n * What the GTAO pass is asked for.\n *\n * @internal\n */\nexport interface AmbientOcclusionOptions {\n /** `\"half\"` or `\"full\"` resolution. */\n readonly quality: \"half\" | \"full\";\n /** World-space radius. */\n readonly radius: number;\n /** Exponent on the visibility. */\n readonly intensity: number;\n /** Fraction of the radius over which occluders fade. */\n readonly falloff: number;\n /** Where an asynchronous rebuild's failure goes. */\n readonly onError: (error: unknown) => void;\n}\n\n/**\n * The slice and step counts and the resolution divisor of a quality.\n *\n * @internal\n */\nexport interface GtaoShape {\n /** Full-resolution pixels per AO pixel along each axis: 2 or 1. */\n readonly scale: number;\n /** The depth-pyramid level the centre depth is read from. */\n readonly baseMip: number;\n /** Screen-space slices per pixel. */\n readonly slices: number;\n /** Steps along each side of a slice. */\n readonly steps: number;\n}\n\n/**\n * The shape of a quality: `\"half\"` is 2 slices × 4 steps at half resolution, `\"full\"` 3 × 6 at full.\n *\n * @param quality - The quality.\n * @returns The shape.\n *\n * @internal\n */\nexport function gtaoShape(quality: \"half\" | \"full\"): GtaoShape {\n return quality === \"full\"\n ? { scale: 1, baseMip: 0, slices: 3, steps: 6 }\n : { scale: 2, baseMip: 1, slices: 2, steps: 4 };\n}\n\n/**\n * A running GTAO pass.\n *\n * @internal\n */\nexport interface AmbientOcclusion {\n /** The denoised AO texture, `rgba8unorm`, AO in every colour channel; replaced on resize. */\n readonly texture: ComputeStorageTexture2D;\n /**\n * Attaches the plugin to lit PBR materials that lack it and retires old textures. Once a frame.\n *\n * @param isSceneRegistered - Whether a patched material's pipelines must be rebuilt.\n */\n update(isSceneRegistered: boolean): void;\n /** Removes the tasks, frees every GPU object and releases the scene-inputs lease. Idempotent. */\n dispose(): void;\n}\n\n/** One device's worth of GPU objects, rebuilt on resize and device recovery. */\ninterface GpuSet {\n readonly uniforms: UniformBuffer;\n readonly raw: ComputeStorageTexture2D;\n readonly out: ComputeStorageTexture2D;\n readonly shaders: readonly ComputeShader[];\n readonly gtao: ComputeDispatch;\n readonly denoise: ComputeDispatch;\n /** Full-resolution width and height the set was built for. */\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Builds the GTAO compute shader.\n *\n * @param shape - The quality's shape, baked in as constants.\n * @returns The WGSL.\n *\n * @internal\n */\nexport function gtaoWgsl(shape: GtaoShape): string {\n return `\nstruct GtaoParams {\n proj: mat4x4<f32>,\n invProj: mat4x4<f32>,\n view: mat4x4<f32>,\n size: vec4<f32>,\n settings: vec4<f32>,\n};\n@group(0) @binding(0) var<uniform> params: GtaoParams;\n@group(0) @binding(1) var depthPyramid: texture_2d<f32>;\n@group(0) @binding(2) var normals: texture_2d<f32>;\n@group(0) @binding(3) var aoOut: texture_storage_2d<rgba16float, write>;\n\nconst SLICES: u32 = ${String(shape.slices)}u;\nconst STEPS: u32 = ${String(shape.steps)}u;\nconst BASE_MIP: i32 = ${String(shape.baseMip)};\nconst SCALE: f32 = ${shape.scale.toFixed(1)};\nconst PI: f32 = 3.14159265;\nconst HALF_PI: f32 = 1.57079633;\n\nfn loadDepth(pixel: vec2<f32>, mip: i32) -> f32 {\n let dims = vec2<i32>(textureDimensions(depthPyramid, mip));\n let coord = clamp(vec2<i32>(floor(pixel / f32(1 << u32(mip)))), vec2<i32>(0), dims - 1);\n return textureLoad(depthPyramid, coord, mip).r;\n}\n\nfn viewPosition(pixel: vec2<f32>, depth: f32) -> vec3<f32> {\n let uv = pixel / params.size.xy;\n let p = params.invProj * vec4<f32>(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);\n return p.xyz / p.w;\n}\n\nfn ign(p: vec2<f32>) -> f32 {\n return fract(52.9829189 * fract(dot(p, vec2<f32>(0.06711056, 0.00583715))));\n}\n\n@compute @workgroup_size(${String(WORKGROUP)}, ${String(WORKGROUP)})\nfn main(@builtin(global_invocation_id) id: vec3<u32>) {\n if (f32(id.x) >= params.size.z || f32(id.y) >= params.size.w) {\n return;\n }\n let pixel = (vec2<f32>(id.xy) + 0.5) * SCALE;\n let depth = loadDepth(pixel, BASE_MIP);\n if (depth <= 0.0) {\n textureStore(aoOut, vec2<i32>(id.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));\n return;\n }\n let P = viewPosition(pixel, depth);\n let V = normalize(viewPosition(pixel, 1.0) - P);\n let full = vec2<i32>(params.size.xy) - 1;\n let stored = textureLoad(normals, clamp(vec2<i32>(pixel), vec2<i32>(0), full), 0).xyz;\n let N = normalize((params.view * vec4<f32>(stored * 2.0 - 1.0, 0.0)).xyz);\n\n let radius = params.settings.x;\n let falloffRange = max(params.settings.y * radius, 0.0001);\n let c0 = params.proj * vec4<f32>(P, 1.0);\n let c1 = params.proj * vec4<f32>(P + vec3<f32>(radius, 0.0, 0.0), 1.0);\n let screenRadius = min(abs(c1.x / c1.w - c0.x / c0.w) * 0.5 * params.size.x, 0.3 * max(params.size.x, params.size.y));\n if (screenRadius < SCALE) {\n textureStore(aoOut, vec2<i32>(id.xy), vec4<f32>(1.0, abs(P.z), 0.0, 1.0));\n return;\n }\n let maxMip = i32(textureNumLevels(depthPyramid)) - 1;\n let noiseSlice = ign(vec2<f32>(id.xy));\n let noiseStep = ign(vec2<f32>(id.xy) + vec2<f32>(17.0, 59.0));\n\n var visibility = 0.0;\n for (var slice = 0u; slice < SLICES; slice++) {\n let phi = (f32(slice) + noiseSlice) * PI / f32(SLICES);\n let omega = vec2<f32>(cos(phi), -sin(phi));\n let direction = vec3<f32>(omega.x, -omega.y, 0.0);\n let orthoDirection = direction - dot(direction, V) * V;\n let axis = normalize(cross(orthoDirection, V));\n let projected = N - axis * dot(N, axis);\n let projectedLength = length(projected);\n let signN = sign(dot(orthoDirection, projected));\n let cosN = clamp(dot(projected, V) / max(projectedLength, 0.0001), 0.0, 1.0);\n let n = signN * acos(cosN);\n let low0 = cos(n + HALF_PI);\n let low1 = cos(n - HALF_PI);\n var horizon0 = low0;\n var horizon1 = low1;\n for (var step = 0u; step < STEPS; step++) {\n let t = (f32(step) + noiseStep) / f32(STEPS);\n let offsetLength = mix(SCALE, screenRadius, t * t);\n let mip = clamp(i32(floor(log2(offsetLength))) - 3, BASE_MIP, max(maxMip, BASE_MIP));\n let offset = omega * offsetLength;\n let d0 = loadDepth(pixel + offset, mip);\n let d1 = loadDepth(pixel - offset, mip);\n let s0 = viewPosition(pixel + offset, max(d0, 0.000001)) - P;\n let s1 = viewPosition(pixel - offset, max(d1, 0.000001)) - P;\n let l0 = length(s0);\n let l1 = length(s1);\n let w0 = select(0.0, clamp((radius - l0) / falloffRange, 0.0, 1.0), d0 > 0.0);\n let w1 = select(0.0, clamp((radius - l1) / falloffRange, 0.0, 1.0), d1 > 0.0);\n horizon0 = max(horizon0, mix(low0, dot(s0 / max(l0, 0.00001), V), w0));\n horizon1 = max(horizon1, mix(low1, dot(s1 / max(l1, 0.00001), V), w1));\n }\n var h0 = -acos(clamp(horizon1, -1.0, 1.0));\n var h1 = acos(clamp(horizon0, -1.0, 1.0));\n h0 = n + clamp(h0 - n, -HALF_PI, HALF_PI);\n h1 = n + clamp(h1 - n, -HALF_PI, HALF_PI);\n let sinN = sin(n);\n let arc0 = (cosN + 2.0 * h0 * sinN - cos(2.0 * h0 - n)) * 0.25;\n let arc1 = (cosN + 2.0 * h1 * sinN - cos(2.0 * h1 - n)) * 0.25;\n visibility += projectedLength * (arc0 + arc1);\n }\n visibility = clamp(visibility / f32(SLICES), 0.03, 1.0);\n let ao = pow(visibility, params.settings.z);\n textureStore(aoOut, vec2<i32>(id.xy), vec4<f32>(ao, abs(P.z), 0.0, 1.0));\n}\n`;\n}\n\n/**\n * Builds the denoise shader: a 5×5 Gaussian weighted by view-depth similarity.\n *\n * @returns The WGSL.\n *\n * @internal\n */\nexport function gtaoDenoiseWgsl(): string {\n return `\nstruct GtaoParams {\n proj: mat4x4<f32>,\n invProj: mat4x4<f32>,\n view: mat4x4<f32>,\n size: vec4<f32>,\n settings: vec4<f32>,\n};\n@group(0) @binding(0) var<uniform> params: GtaoParams;\n@group(0) @binding(1) var rawAo: texture_2d<f32>;\n@group(0) @binding(2) var aoOut: texture_storage_2d<rgba8unorm, write>;\n\n@compute @workgroup_size(${String(WORKGROUP)}, ${String(WORKGROUP)})\nfn main(@builtin(global_invocation_id) id: vec3<u32>) {\n if (f32(id.x) >= params.size.z || f32(id.y) >= params.size.w) {\n return;\n }\n let dims = vec2<i32>(textureDimensions(rawAo)) - 1;\n let at = vec2<i32>(id.xy);\n let centre = textureLoad(rawAo, at, 0);\n if (centre.y <= 0.0) {\n textureStore(aoOut, at, vec4<f32>(centre.x, centre.x, centre.x, 1.0));\n return;\n }\n let tolerance = max(centre.y * 0.05, 0.0001);\n var sum = 0.0;\n var weights = 0.0;\n for (var y = -2; y <= 2; y++) {\n for (var x = -2; x <= 2; x++) {\n let tap = textureLoad(rawAo, clamp(at + vec2<i32>(x, y), vec2<i32>(0), dims), 0);\n let spatial = exp(-f32(x * x + y * y) / 4.5);\n let similar = max(0.0, 1.0 - abs(tap.y - centre.y) / tolerance);\n let weight = spatial * similar;\n sum += tap.x * weight;\n weights += weight;\n }\n }\n let ao = sum / max(weights, 0.0001);\n textureStore(aoOut, at, vec4<f32>(ao, ao, ao, 1.0));\n}\n`;\n}\n\n/**\n * The plugin code that multiplies a PBR fragment's `occlusion` by the AO texture.\n *\n * @remarks\n * At half resolution the AO texel under the fragment is blended bilinearly from four loads rather\n * than through a sampler, so the result does not depend on the storage texture's sampler. The block\n * scope keeps its names out of the shader's. `input.clipPos` is the fragment's\n * `@builtin(position)`.\n *\n * @param scale - Full-resolution pixels per AO pixel.\n * @returns The WGSL for `CUSTOM_FRAGMENT_BEFORE_LIGHTS`.\n *\n * @internal\n */\nexport function gtaoPluginWgsl(scale: number): string {\n if (scale === 1) {\n return (\n \"{let igxAoMax=vec2<i32>(textureDimensions(ignifxAo))-1;\" +\n \"occlusion*=textureLoad(ignifxAo,clamp(vec2<i32>(input.clipPos.xy),vec2<i32>(0),igxAoMax),0).r;}\"\n );\n }\n return (\n \"{let igxAoMax=vec2<i32>(textureDimensions(ignifxAo))-1;\" +\n `let igxAoF=input.clipPos.xy/${scale.toFixed(1)}-0.5;` +\n \"let igxAoB=vec2<i32>(floor(igxAoF));let igxAoT=fract(igxAoF);\" +\n \"let igxAo00=textureLoad(ignifxAo,clamp(igxAoB,vec2<i32>(0),igxAoMax),0).r;\" +\n \"let igxAo10=textureLoad(ignifxAo,clamp(igxAoB+vec2<i32>(1,0),vec2<i32>(0),igxAoMax),0).r;\" +\n \"let igxAo01=textureLoad(ignifxAo,clamp(igxAoB+vec2<i32>(0,1),vec2<i32>(0),igxAoMax),0).r;\" +\n \"let igxAo11=textureLoad(ignifxAo,clamp(igxAoB+vec2<i32>(1,1),vec2<i32>(0),igxAoMax),0).r;\" +\n \"occlusion*=mix(mix(igxAo00,igxAo10,igxAoT.x),mix(igxAo01,igxAo11,igxAoT.x),igxAoT.y);}\"\n );\n}\n\n/**\n * Builds the material plugin that applies the AO texture to indirect light.\n *\n * @param scale - Full-resolution pixels per AO pixel.\n * @param texture - Reads the current AO texture; it changes on resize.\n * @returns The plugin, shared by every lit PBR material.\n *\n * @internal\n */\nexport function createAmbientOcclusionPlugin(scale: number, texture: () => ComputeStorageTexture2D): MaterialPlugin {\n const fragment = { CUSTOM_FRAGMENT_BEFORE_LIGHTS: gtaoPluginWgsl(scale) };\n return {\n name: GTAO_PLUGIN_NAME,\n priority: 600,\n getSamplers: () => [{ texture: \"ignifxAo\", sampler: \"ignifxAoSampler\" }],\n // No `getActiveTextures`: the texture is the pass's own, and a material holding a pool reference\n // would stop it from being disposed on resize.\n bindTextures: (out) => {\n out.push({ texture: texture().sampledTexture });\n },\n getCustomCode: (stage) => (stage === \"fragment\" ? fragment : null),\n };\n}\n\n/**\n * Builds the GTAO pass, splices its tasks in after the scene inputs, and returns its handle.\n *\n * @remarks\n * Called once, from the renderer, with a scene-inputs lease the handle now owns. Before the scene is\n * registered (`isFrameGraphBuilt` `false`) `registerScene` records the tasks; afterwards they are\n * recorded here.\n *\n * @param engine - The engine.\n * @param scene - The render scene.\n * @param inputs - A scene-inputs lease; released by {@link AmbientOcclusion.dispose}.\n * @param options - The resolved settings.\n * @param isFrameGraphBuilt - Whether the scene is registered.\n * @returns The handle.\n *\n * @internal\n */\nexport async function createAmbientOcclusion(\n engine: EngineContext,\n scene: SceneContext,\n inputs: SceneInputs,\n options: AmbientOcclusionOptions,\n isFrameGraphBuilt: boolean,\n): Promise<AmbientOcclusion> {\n const shape = gtaoShape(options.quality);\n let current = await buildGpuSet(engine, inputs, shape);\n const retired: { set: GpuSet; frames: number }[] = [];\n const data = new Float32Array(UNIFORM_FLOATS);\n let isDisposed = false;\n let generation = 0;\n\n const compute: ComputeTask = createComputeTask(engine, GTAO_TASK_NAMES.compute);\n addComputeDispatch(compute, current.gtao);\n addComputeDispatch(compute, current.denoise);\n const params = createExecuteTask(engine, scene, GTAO_TASK_NAMES.params, () => {\n const enabled = writeParams(scene, current, shape, options, data);\n current.gtao.enabled = enabled;\n current.denoise.enabled = enabled;\n if (enabled) {\n updateUniformBuffer(engine, current.uniforms, data);\n }\n });\n const tasks: readonly Task[] = [params, compute];\n const pyramid = frameGraphTasks(scene)?.find((task) => task.name === SCENE_INPUT_TASK_NAMES.depthPyramid);\n if (pyramid === undefined) {\n disposeGpuSet(current);\n inputs.release();\n throw new Error(\"GTAO needs the scene inputs' depth pyramid task in the frame graph.\");\n }\n addTaskAfter(scene, params, pyramid);\n addTaskAfter(scene, compute, params);\n if (isFrameGraphBuilt) {\n const graph = getFrameGraph(scene);\n for (const task of tasks) {\n buildFrameGraphTask(graph, task);\n }\n }\n\n const plugin = createAmbientOcclusionPlugin(shape.scale, () => current.out);\n const stopWatch = inputs.onChange(() => {\n generation += 1;\n const mine = generation;\n // The pyramid and the input textures were replaced; the bindings name freed ones.\n compute.executionEnabled = false;\n buildGpuSet(engine, inputs, shape).then(\n (next) => {\n if (isDisposed || mine !== generation) {\n disposeGpuSet(next);\n return;\n }\n removeComputeDispatch(compute, current.gtao);\n removeComputeDispatch(compute, current.denoise);\n addComputeDispatch(compute, next.gtao);\n addComputeDispatch(compute, next.denoise);\n retired.push({ set: current, frames: RETIRE_FRAMES });\n current = next;\n compute.executionEnabled = true;\n rebuildPatchedMaterials(scene, plugin);\n },\n (error: unknown) => {\n options.onError(error);\n },\n );\n });\n\n return {\n get texture(): ComputeStorageTexture2D {\n return current.out;\n },\n update(isSceneRegistered: boolean): void {\n if (isDisposed) {\n return;\n }\n attachPlugin(scene, plugin, isSceneRegistered);\n for (let index = retired.length - 1; index >= 0; index -= 1) {\n const entry = retired[index];\n if (entry !== undefined && --entry.frames <= 0) {\n disposeGpuSet(entry.set);\n retired.splice(index, 1);\n }\n }\n },\n dispose(): void {\n if (isDisposed) {\n return;\n }\n isDisposed = true;\n stopWatch();\n const list = frameGraphTasks(scene);\n for (const task of tasks) {\n // Disable first: a disposed task that still executes is a use-after-free.\n task.executionEnabled = false;\n const index = list?.indexOf(task) ?? -1;\n if (list !== null && index >= 0) {\n list.splice(index, 1);\n }\n task.dispose();\n }\n disposeGpuSet(current);\n for (const entry of retired) {\n disposeGpuSet(entry.set);\n }\n retired.length = 0;\n inputs.release();\n },\n };\n}\n\n/**\n * Writes this frame's uniforms from the scene's camera.\n *\n * @param scene - The scene.\n * @param set - The current GPU set, for its sizes.\n * @param shape - The quality's shape.\n * @param options - The settings.\n * @param out - The uniform floats.\n * @returns `false` when there is no camera or its projection does not invert, so the pass skips.\n */\nfunction writeParams(\n scene: SceneContext,\n set: GpuSet,\n shape: GtaoShape,\n options: AmbientOcclusionOptions,\n out: Float32Array,\n): boolean {\n const camera = scene.camera;\n if (camera === null) {\n return false;\n }\n const projection = getProjectionMatrix(camera, getEffectiveAspectRatio(camera, set.width, set.height));\n const inverse = invertMat4(projection);\n if (inverse === null) {\n return false;\n }\n copyMat4(projection, out, 0);\n copyMat4(inverse, out, 16);\n copyMat4(getViewMatrix(camera), out, 32);\n out[48] = set.width;\n out[49] = set.height;\n out[50] = set.raw.width;\n out[51] = set.raw.height;\n out[52] = options.radius;\n out[53] = options.falloff;\n out[54] = options.intensity;\n out[55] = shape.slices;\n return true;\n}\n\n/**\n * Copies a Lite matrix into a float array.\n *\n * @param matrix - The matrix, column-major.\n * @param out - The destination.\n * @param offset - Where the 16 floats start.\n */\nfunction copyMat4(matrix: Mat4, out: Float32Array, offset: number): void {\n for (let index = 0; index < 16; index += 1) {\n out[offset + index] = matrix[index] ?? 0;\n }\n}\n\n/**\n * Creates the textures, shaders and bindings for the current surface size and device.\n *\n * @param engine - The engine.\n * @param inputs - The scene-inputs lease.\n * @param shape - The quality's shape.\n * @returns The set.\n */\nasync function buildGpuSet(engine: EngineContext, inputs: SceneInputs, shape: GtaoShape): Promise<GpuSet> {\n const width = inputs.depth.width;\n const height = inputs.depth.height;\n const aoWidth = Math.max(1, Math.ceil(width / shape.scale));\n const aoHeight = Math.max(1, Math.ceil(height / shape.scale));\n const [pyramid, normals] = await Promise.all([\n createComputeTextureResource(engine, inputs.depthPyramid, { sampleType: \"unfilterable-float\" }),\n createComputeTextureResource(engine, inputs.normals, { sampleType: \"unfilterable-float\" }),\n ]);\n const uniforms = createUniformBuffer(engine, UNIFORM_FLOATS * 4, { label: \"ignifx:gtao-params\" });\n const raw = createComputeStorageTexture2D(engine, {\n width: aoWidth,\n height: aoHeight,\n format: \"rgba16float\",\n label: \"ignifx:gtao-raw\",\n invertY: false,\n });\n const out = createComputeStorageTexture2D(engine, {\n width: aoWidth,\n height: aoHeight,\n format: \"rgba8unorm\",\n label: \"ignifx:gtao\",\n invertY: false,\n });\n const gtaoShader = createComputeShader(engine, {\n name: \"ignifx:gtao\",\n computeSource: gtaoWgsl(shape),\n bindings: [\n computeUniformBufferBinding(\"params\", { group: 0, binding: 0 }),\n computeTextureBinding(\"depthPyramid\", { group: 0, binding: 1, sampleType: \"unfilterable-float\" }),\n computeTextureBinding(\"normals\", { group: 0, binding: 2, sampleType: \"unfilterable-float\" }),\n computeStorageTextureBinding(\"aoOut\", { group: 0, binding: 3, format: \"rgba16float\" }),\n ],\n });\n const denoiseShader = createComputeShader(engine, {\n name: \"ignifx:gtao-denoise\",\n computeSource: gtaoDenoiseWgsl(),\n bindings: [\n computeUniformBufferBinding(\"params\", { group: 0, binding: 0 }),\n computeTextureBinding(\"rawAo\", { group: 0, binding: 1, sampleType: \"float\" }),\n computeStorageTextureBinding(\"aoOut\", { group: 0, binding: 2, format: \"rgba8unorm\" }),\n ],\n });\n const size = { x: Math.ceil(aoWidth / WORKGROUP), y: Math.ceil(aoHeight / WORKGROUP) };\n const gtao = createComputeDispatch(\n gtaoShader,\n createComputeBindingSet(gtaoShader, { params: uniforms, depthPyramid: pyramid, normals, aoOut: raw }),\n { size, enabled: false },\n );\n const denoise = createComputeDispatch(\n denoiseShader,\n createComputeBindingSet(denoiseShader, { params: uniforms, rawAo: raw.computeTexture, aoOut: out }),\n { size, enabled: false },\n );\n return { uniforms, raw, out, shaders: [gtaoShader, denoiseShader], gtao, denoise, width, height };\n}\n\n/**\n * Frees a set's GPU objects.\n *\n * @param set - The set.\n */\nfunction disposeGpuSet(set: GpuSet): void {\n set.gtao.enabled = false;\n set.denoise.enabled = false;\n disposeComputeBindingSet(set.gtao.bindings);\n disposeComputeBindingSet(set.denoise.bindings);\n for (const shader of set.shaders) {\n disposeComputeShader(shader);\n }\n disposeComputeStorageTexture2D(set.raw);\n disposeComputeStorageTexture2D(set.out);\n disposeUniformBuffer(set.uniforms);\n}\n\n/**\n * Creates a frame-graph task that runs a callback each frame, inside the frame graph.\n *\n * @remarks\n * Lite runs a task's `execute()` fast path instead of its recorded passes\n * (`lib/frame-graph/frame-graph.js`); `record()` and `build()` clear and walk `_passes`, which such\n * a task leaves empty. It runs after Lite's per-frame world-matrix update, unlike `onBeforeRender`.\n *\n * @param engine - The engine.\n * @param scene - The scene.\n * @param name - The task name.\n * @param run - The callback.\n * @returns The task.\n */\nfunction createExecuteTask(engine: EngineContext, scene: SceneContext, name: string, run: () => void): Task {\n const task = {\n name,\n engine,\n scene,\n executionEnabled: true,\n // oxlint-disable-next-line no-underscore-dangle\n _passes: [] as unknown[],\n record(): void {\n // Nothing to record: the work happens in `execute`.\n },\n execute(): number {\n run();\n return 0;\n },\n dispose(): void {\n // Owns nothing.\n },\n };\n return task;\n}\n\n/**\n * Gives every lit PBR material in the scene the AO plugin, once.\n *\n * @remarks\n * A walk, for the reasons `./hdr-output.ts`'s `attachLinearOutput` gives: materials come from many\n * places, and a surface shader replaces a material's plugin list.\n *\n * @param scene - The scene.\n * @param plugin - The shared plugin.\n * @param isSceneRegistered - Whether a patched material's pipelines must be rebuilt.\n */\nfunction attachPlugin(scene: SceneContext, plugin: MaterialPlugin, isSceneRegistered: boolean): void {\n const meshes = scene.meshes;\n for (let index = 0; index < meshes.length; index += 1) {\n const material = meshes[index]?.material;\n // Declared non-null, but Lite's mesh factories create meshes with `material: null`.\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (material === undefined || material === null || !isPbrMaterial(material)) {\n continue;\n }\n if (getPbrUnlit(material) !== undefined) {\n continue;\n }\n const current = material.plugins ?? [];\n if (current.includes(plugin)) {\n continue;\n }\n material.plugins = [...current, plugin];\n if (isSceneRegistered) {\n rebuildMaterialPipelines(scene, material);\n }\n }\n}\n\n/**\n * Rebuilds every material that carries the plugin, so its bind group names the new AO texture.\n *\n * @param scene - The scene.\n * @param plugin - The shared plugin.\n */\nfunction rebuildPatchedMaterials(scene: SceneContext, plugin: MaterialPlugin): void {\n const seen = new Set<Material>();\n const meshes = scene.meshes;\n for (let index = 0; index < meshes.length; index += 1) {\n const material = meshes[index]?.material;\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (material === undefined || material === null || seen.has(material) || !isPbrMaterial(material)) {\n continue;\n }\n seen.add(material);\n if (material.plugins?.includes(plugin) === true) {\n rebuildMaterialPipelines(scene, material);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,kBAAkB;CAAE,QAAQ;CAAsB,SAAS;AAAc;;;;;;AAOtF,MAAa,mBAAmB;;AAGhC,MAAM,iBAAiB;;AAGvB,MAAM,gBAAgB;;AAGtB,MAAM,YAAY;;;;;;;;;AA4ClB,SAAgB,UAAU,SAAqC;CAC7D,OAAO,YAAY,SACf;EAAE,OAAO;EAAG,SAAS;EAAG,QAAQ;EAAG,OAAO;CAAE,IAC5C;EAAE,OAAO;EAAG,SAAS;EAAG,QAAQ;EAAG,OAAO;CAAE;AAClD;;;;;;;;;AAyCA,SAAgB,SAAS,OAA0B;CACjD,OAAO;;;;;;;;;;;;;sBAaa,OAAO,MAAM,MAAM,EAAE;qBACtB,OAAO,MAAM,KAAK,EAAE;wBACjB,OAAO,MAAM,OAAO,EAAE;qBACzB,MAAM,MAAM,QAAQ,CAAC,EAAE;;;;;;;;;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,mBAAkC;CACnG,MAAM,SAAS,MAAM;CACrB,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACrD,MAAM,WAAW,OAAO,MAAM,EAAE;EAGhC,IAAI,aAAa,KAAA,KAAa,aAAa,QAAQ,CAAC,cAAc,QAAQ,GACxE;EAEF,IAAI,YAAY,QAAQ,MAAM,KAAA,GAC5B;EAEF,MAAM,UAAU,SAAS,WAAW,CAAC;EACrC,IAAI,QAAQ,SAAS,MAAM,GACzB;EAEF,SAAS,UAAU,CAAC,GAAG,SAAS,MAAM;EACtC,IAAI,mBACF,yBAAyB,OAAO,QAAQ;CAE5C;AACF;;;;;;;AAQA,SAAS,wBAAwB,OAAqB,QAA8B;CAClF,MAAM,uBAAO,IAAI,IAAc;CAC/B,MAAM,SAAS,MAAM;CACrB,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACrD,MAAM,WAAW,OAAO,MAAM,EAAE;EAEhC,IAAI,aAAa,KAAA,KAAa,aAAa,QAAQ,KAAK,IAAI,QAAQ,KAAK,CAAC,cAAc,QAAQ,GAC9F;EAEF,KAAK,IAAI,QAAQ;EACjB,IAAI,SAAS,SAAS,SAAS,MAAM,MAAM,MACzC,yBAAyB,OAAO,QAAQ;CAE5C;AACF"}
1
+ {"version":3,"file":"gtao-CVAYWBEJ.js","names":[],"sources":["../src/lite/gpu/gtao.ts"],"sourcesContent":["import {\n addComputeDispatch,\n addTaskAfter,\n buildFrameGraphTask,\n computeTextureBinding,\n computeStorageTextureBinding,\n computeUniformBufferBinding,\n createComputeBindingSet,\n createComputeDispatch,\n createComputeShader,\n createComputeStorageTexture2D,\n createComputeTask,\n createComputeTextureResource,\n createUniformBuffer,\n disposeComputeBindingSet,\n disposeComputeShader,\n disposeComputeStorageTexture2D,\n disposeUniformBuffer,\n getEffectiveAspectRatio,\n getFrameGraph,\n getPbrUnlit,\n getProjectionMatrix,\n getViewMatrix,\n invertMat4,\n isPbrMaterial,\n removeComputeDispatch,\n updateUniformBuffer,\n} from \"@babylonjs/lite\";\nimport { rebuildMaterialPipelines } from \"../material.js\";\nimport { frameGraphTasks, SCENE_INPUT_TASK_NAMES } from \"./scene-inputs.js\";\nimport type { SceneInputs } from \"./scene-inputs.js\";\nimport type {\n ComputeDispatch,\n ComputeShader,\n ComputeStorageTexture2D,\n ComputeTask,\n EngineContext,\n Mat4,\n Material,\n MaterialPlugin,\n SceneContext,\n Task,\n UniformBuffer,\n} from \"@babylonjs/lite\";\n\n/**\n * Ground-truth ambient occlusion (`docs/architecture/07-rendering.md` §2.14). Its own chunk: the\n * renderer imports it only when `rendering.ambientOcclusion.enabled` is on, so a project without it\n * loads none of it and its frame graph has none of these tasks (`CONSTITUTION.md` §2.5).\n *\n * ```text\n * … depth pyramid → gtao params → gtao (compute: horizons, then depth-aware blur) → scene → …\n * └─ AO texture ─→ every lit PBR material's `occlusion`\n * ```\n *\n * - **GTAO** (Jimenez et al. 2016, after XeGTAO): per pixel, a few screen-space slices through the\n * view vector; along each, the highest horizon on either side within `radius`, then the cosine-\n * weighted visible arc between them against the normal projected into the slice. Depth comes from\n * the scene inputs' depth pyramid (level 1 at half resolution, coarser levels for far taps), normals\n * from the scene inputs' world normals, rotated into view space. Slice angle and step offset are\n * jittered per pixel with interleaved gradient noise.\n * - **Denoise.** A 5×5 blur weighted by view-depth similarity, in the same compute pass.\n * - **Indirect light only.** {@link createAmbientOcclusionPlugin} multiplies Lite's PBR\n * `occlusion` variable, which scales the environment's irradiance and specular occlusion and\n * nothing else (`lib/material/pbr/fragments/ibl-fragment.js`), by the AO texture at the\n * fragment's screen position. Every lit PBR variant declares `occlusion` before that slot: the\n * template's `occlusionDefault`, or the reflectance extension's own `AT` code\n * (`lib/material/pbr/fragments/reflectance-fragment.js` line 146). Standard materials, unlit PBR and\n * custom shaders are left alone.\n * - **Camera matrices** are written by a tiny task that runs inside the frame graph, after Lite has\n * updated world matrices for the frame, so the AO never lags a moving camera.\n * - **Resize and device loss.** The scene inputs' `onChange` disables the pass, rebuilds the\n * textures and bindings, swaps them in, and rebuilds the patched materials, whose bind groups hold\n * the AO texture's view. The old textures are disposed a few frames later, once no in-flight bind\n * group can still name them.\n * - **TAA.** `rendering.taa` filters the final colour, AO included; a dedicated AO history is\n * not wired. It would accumulate {@link AmbientOcclusion.texture} before the plugin reads it.\n */\n\n/**\n * The frame-graph task names, in the order they run after the scene inputs.\n *\n * @internal\n */\nexport const GTAO_TASK_NAMES = { params: \"ignifx:gtao-params\", compute: \"ignifx:gtao\" } as const;\n\n/**\n * The name the material plugin carries; part of Lite's pipeline cache key.\n *\n * @internal\n */\nexport const GTAO_PLUGIN_NAME = \"ignifx-gtao\";\n\n/** The uniform block: three matrices, the sizes, the settings. */\nconst UNIFORM_FLOATS = 16 * 3 + 4 + 4;\n\n/** Frames an old texture set outlives its replacement. */\nconst RETIRE_FRAMES = 8;\n\n/** The workgroup edge both shaders use. */\nconst WORKGROUP = 8;\n\n/**\n * What the GTAO pass is asked for.\n *\n * @internal\n */\nexport interface AmbientOcclusionOptions {\n /** `\"half\"` or `\"full\"` resolution. */\n readonly quality: \"half\" | \"full\";\n /** World-space radius. */\n readonly radius: number;\n /** Exponent on the visibility. */\n readonly intensity: number;\n /** Fraction of the radius over which occluders fade. */\n readonly falloff: number;\n /** Where an asynchronous rebuild's failure goes. */\n readonly onError: (error: unknown) => void;\n}\n\n/**\n * The slice and step counts and the resolution divisor of a quality.\n *\n * @internal\n */\nexport interface GtaoShape {\n /** Full-resolution pixels per AO pixel along each axis: 2 or 1. */\n readonly scale: number;\n /** The depth-pyramid level the centre depth is read from. */\n readonly baseMip: number;\n /** Screen-space slices per pixel. */\n readonly slices: number;\n /** Steps along each side of a slice. */\n readonly steps: number;\n}\n\n/**\n * The shape of a quality: `\"half\"` is 2 slices × 4 steps at half resolution, `\"full\"` 3 × 6 at full.\n *\n * @param quality - The quality.\n * @returns The shape.\n *\n * @internal\n */\nexport function gtaoShape(quality: \"half\" | \"full\"): GtaoShape {\n return quality === \"full\"\n ? { scale: 1, baseMip: 0, slices: 3, steps: 6 }\n : { scale: 2, baseMip: 1, slices: 2, steps: 4 };\n}\n\n/**\n * A running GTAO pass.\n *\n * @internal\n */\nexport interface AmbientOcclusion {\n /** The denoised AO texture, `rgba8unorm`, AO in every colour channel; replaced on resize. */\n readonly texture: ComputeStorageTexture2D;\n /**\n * Attaches the plugin to lit PBR materials that lack it and retires old textures. Once a frame.\n *\n * @param isSceneRegistered - Whether a patched material's pipelines must be rebuilt.\n */\n update(isSceneRegistered: boolean): void;\n /** Removes the tasks, frees every GPU object and releases the scene-inputs lease. Idempotent. */\n dispose(): void;\n}\n\n/** One device's worth of GPU objects, rebuilt on resize and device recovery. */\ninterface GpuSet {\n readonly uniforms: UniformBuffer;\n readonly raw: ComputeStorageTexture2D;\n readonly out: ComputeStorageTexture2D;\n readonly shaders: readonly ComputeShader[];\n readonly gtao: ComputeDispatch;\n readonly denoise: ComputeDispatch;\n /** Full-resolution width and height the set was built for. */\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Builds the GTAO compute shader.\n *\n * @param shape - The quality's shape, baked in as constants.\n * @returns The WGSL.\n *\n * @internal\n */\nexport function gtaoWgsl(shape: GtaoShape): string {\n return `\nstruct GtaoParams {\n proj: mat4x4<f32>,\n invProj: mat4x4<f32>,\n view: mat4x4<f32>,\n size: vec4<f32>,\n settings: vec4<f32>,\n};\n@group(0) @binding(0) var<uniform> params: GtaoParams;\n@group(0) @binding(1) var depthPyramid: texture_2d<f32>;\n@group(0) @binding(2) var normals: texture_2d<f32>;\n@group(0) @binding(3) var aoOut: texture_storage_2d<rgba16float, write>;\n\nconst SLICES: u32 = ${String(shape.slices)}u;\nconst STEPS: u32 = ${String(shape.steps)}u;\nconst BASE_MIP: i32 = ${String(shape.baseMip)};\nconst SCALE: f32 = ${shape.scale.toFixed(1)};\nconst PI: f32 = 3.14159265;\nconst HALF_PI: f32 = 1.57079633;\n\nfn loadDepth(pixel: vec2<f32>, mip: i32) -> f32 {\n let dims = vec2<i32>(textureDimensions(depthPyramid, mip));\n let coord = clamp(vec2<i32>(floor(pixel / f32(1 << u32(mip)))), vec2<i32>(0), dims - 1);\n return textureLoad(depthPyramid, coord, mip).r;\n}\n\nfn viewPosition(pixel: vec2<f32>, depth: f32) -> vec3<f32> {\n let uv = pixel / params.size.xy;\n let p = params.invProj * vec4<f32>(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);\n return p.xyz / p.w;\n}\n\nfn ign(p: vec2<f32>) -> f32 {\n return fract(52.9829189 * fract(dot(p, vec2<f32>(0.06711056, 0.00583715))));\n}\n\n@compute @workgroup_size(${String(WORKGROUP)}, ${String(WORKGROUP)})\nfn main(@builtin(global_invocation_id) id: vec3<u32>) {\n if (f32(id.x) >= params.size.z || f32(id.y) >= params.size.w) {\n return;\n }\n let pixel = (vec2<f32>(id.xy) + 0.5) * SCALE;\n let depth = loadDepth(pixel, BASE_MIP);\n if (depth <= 0.0) {\n textureStore(aoOut, vec2<i32>(id.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));\n return;\n }\n let P = viewPosition(pixel, depth);\n let V = normalize(viewPosition(pixel, 1.0) - P);\n let full = vec2<i32>(params.size.xy) - 1;\n let stored = textureLoad(normals, clamp(vec2<i32>(pixel), vec2<i32>(0), full), 0).xyz;\n let N = normalize((params.view * vec4<f32>(stored * 2.0 - 1.0, 0.0)).xyz);\n\n let radius = params.settings.x;\n let falloffRange = max(params.settings.y * radius, 0.0001);\n let c0 = params.proj * vec4<f32>(P, 1.0);\n let c1 = params.proj * vec4<f32>(P + vec3<f32>(radius, 0.0, 0.0), 1.0);\n let screenRadius = min(abs(c1.x / c1.w - c0.x / c0.w) * 0.5 * params.size.x, 0.3 * max(params.size.x, params.size.y));\n if (screenRadius < SCALE) {\n textureStore(aoOut, vec2<i32>(id.xy), vec4<f32>(1.0, abs(P.z), 0.0, 1.0));\n return;\n }\n let maxMip = i32(textureNumLevels(depthPyramid)) - 1;\n let noiseSlice = ign(vec2<f32>(id.xy));\n let noiseStep = ign(vec2<f32>(id.xy) + vec2<f32>(17.0, 59.0));\n\n var visibility = 0.0;\n for (var slice = 0u; slice < SLICES; slice++) {\n let phi = (f32(slice) + noiseSlice) * PI / f32(SLICES);\n let omega = vec2<f32>(cos(phi), -sin(phi));\n let direction = vec3<f32>(omega.x, -omega.y, 0.0);\n let orthoDirection = direction - dot(direction, V) * V;\n let axis = normalize(cross(orthoDirection, V));\n let projected = N - axis * dot(N, axis);\n let projectedLength = length(projected);\n let signN = sign(dot(orthoDirection, projected));\n let cosN = clamp(dot(projected, V) / max(projectedLength, 0.0001), 0.0, 1.0);\n let n = signN * acos(cosN);\n let low0 = cos(n + HALF_PI);\n let low1 = cos(n - HALF_PI);\n var horizon0 = low0;\n var horizon1 = low1;\n for (var step = 0u; step < STEPS; step++) {\n let t = (f32(step) + noiseStep) / f32(STEPS);\n let offsetLength = mix(SCALE, screenRadius, t * t);\n let mip = clamp(i32(floor(log2(offsetLength))) - 3, BASE_MIP, max(maxMip, BASE_MIP));\n let offset = omega * offsetLength;\n let d0 = loadDepth(pixel + offset, mip);\n let d1 = loadDepth(pixel - offset, mip);\n let s0 = viewPosition(pixel + offset, max(d0, 0.000001)) - P;\n let s1 = viewPosition(pixel - offset, max(d1, 0.000001)) - P;\n let l0 = length(s0);\n let l1 = length(s1);\n let w0 = select(0.0, clamp((radius - l0) / falloffRange, 0.0, 1.0), d0 > 0.0);\n let w1 = select(0.0, clamp((radius - l1) / falloffRange, 0.0, 1.0), d1 > 0.0);\n horizon0 = max(horizon0, mix(low0, dot(s0 / max(l0, 0.00001), V), w0));\n horizon1 = max(horizon1, mix(low1, dot(s1 / max(l1, 0.00001), V), w1));\n }\n var h0 = -acos(clamp(horizon1, -1.0, 1.0));\n var h1 = acos(clamp(horizon0, -1.0, 1.0));\n h0 = n + clamp(h0 - n, -HALF_PI, HALF_PI);\n h1 = n + clamp(h1 - n, -HALF_PI, HALF_PI);\n let sinN = sin(n);\n let arc0 = (cosN + 2.0 * h0 * sinN - cos(2.0 * h0 - n)) * 0.25;\n let arc1 = (cosN + 2.0 * h1 * sinN - cos(2.0 * h1 - n)) * 0.25;\n visibility += projectedLength * (arc0 + arc1);\n }\n visibility = clamp(visibility / f32(SLICES), 0.03, 1.0);\n let ao = pow(visibility, params.settings.z);\n textureStore(aoOut, vec2<i32>(id.xy), vec4<f32>(ao, abs(P.z), 0.0, 1.0));\n}\n`;\n}\n\n/**\n * Builds the denoise shader: a 5×5 Gaussian weighted by view-depth similarity.\n *\n * @returns The WGSL.\n *\n * @internal\n */\nexport function gtaoDenoiseWgsl(): string {\n return `\nstruct GtaoParams {\n proj: mat4x4<f32>,\n invProj: mat4x4<f32>,\n view: mat4x4<f32>,\n size: vec4<f32>,\n settings: vec4<f32>,\n};\n@group(0) @binding(0) var<uniform> params: GtaoParams;\n@group(0) @binding(1) var rawAo: texture_2d<f32>;\n@group(0) @binding(2) var aoOut: texture_storage_2d<rgba8unorm, write>;\n\n@compute @workgroup_size(${String(WORKGROUP)}, ${String(WORKGROUP)})\nfn main(@builtin(global_invocation_id) id: vec3<u32>) {\n if (f32(id.x) >= params.size.z || f32(id.y) >= params.size.w) {\n return;\n }\n let dims = vec2<i32>(textureDimensions(rawAo)) - 1;\n let at = vec2<i32>(id.xy);\n let centre = textureLoad(rawAo, at, 0);\n if (centre.y <= 0.0) {\n textureStore(aoOut, at, vec4<f32>(centre.x, centre.x, centre.x, 1.0));\n return;\n }\n let tolerance = max(centre.y * 0.05, 0.0001);\n var sum = 0.0;\n var weights = 0.0;\n for (var y = -2; y <= 2; y++) {\n for (var x = -2; x <= 2; x++) {\n let tap = textureLoad(rawAo, clamp(at + vec2<i32>(x, y), vec2<i32>(0), dims), 0);\n let spatial = exp(-f32(x * x + y * y) / 4.5);\n let similar = max(0.0, 1.0 - abs(tap.y - centre.y) / tolerance);\n let weight = spatial * similar;\n sum += tap.x * weight;\n weights += weight;\n }\n }\n let ao = sum / max(weights, 0.0001);\n textureStore(aoOut, at, vec4<f32>(ao, ao, ao, 1.0));\n}\n`;\n}\n\n/**\n * The plugin code that multiplies a PBR fragment's `occlusion` by the AO texture.\n *\n * @remarks\n * At half resolution the AO texel under the fragment is blended bilinearly from four loads rather\n * than through a sampler, so the result does not depend on the storage texture's sampler. The block\n * scope keeps its names out of the shader's. `input.clipPos` is the fragment's\n * `@builtin(position)`.\n *\n * @param scale - Full-resolution pixels per AO pixel.\n * @returns The WGSL for `CUSTOM_FRAGMENT_BEFORE_LIGHTS`.\n *\n * @internal\n */\nexport function gtaoPluginWgsl(scale: number): string {\n if (scale === 1) {\n return (\n \"{let igxAoMax=vec2<i32>(textureDimensions(ignifxAo))-1;\" +\n \"occlusion*=textureLoad(ignifxAo,clamp(vec2<i32>(input.clipPos.xy),vec2<i32>(0),igxAoMax),0).r;}\"\n );\n }\n return (\n \"{let igxAoMax=vec2<i32>(textureDimensions(ignifxAo))-1;\" +\n `let igxAoF=input.clipPos.xy/${scale.toFixed(1)}-0.5;` +\n \"let igxAoB=vec2<i32>(floor(igxAoF));let igxAoT=fract(igxAoF);\" +\n \"let igxAo00=textureLoad(ignifxAo,clamp(igxAoB,vec2<i32>(0),igxAoMax),0).r;\" +\n \"let igxAo10=textureLoad(ignifxAo,clamp(igxAoB+vec2<i32>(1,0),vec2<i32>(0),igxAoMax),0).r;\" +\n \"let igxAo01=textureLoad(ignifxAo,clamp(igxAoB+vec2<i32>(0,1),vec2<i32>(0),igxAoMax),0).r;\" +\n \"let igxAo11=textureLoad(ignifxAo,clamp(igxAoB+vec2<i32>(1,1),vec2<i32>(0),igxAoMax),0).r;\" +\n \"occlusion*=mix(mix(igxAo00,igxAo10,igxAoT.x),mix(igxAo01,igxAo11,igxAoT.x),igxAoT.y);}\"\n );\n}\n\n/**\n * Builds the material plugin that applies the AO texture to indirect light.\n *\n * @param scale - Full-resolution pixels per AO pixel.\n * @param texture - Reads the current AO texture; it changes on resize.\n * @returns The plugin, shared by every lit PBR material.\n *\n * @internal\n */\nexport function createAmbientOcclusionPlugin(scale: number, texture: () => ComputeStorageTexture2D): MaterialPlugin {\n const fragment = { CUSTOM_FRAGMENT_BEFORE_LIGHTS: gtaoPluginWgsl(scale) };\n return {\n name: GTAO_PLUGIN_NAME,\n priority: 600,\n getSamplers: () => [{ texture: \"ignifxAo\", sampler: \"ignifxAoSampler\" }],\n // No `getActiveTextures`: the texture is the pass's own, and a material holding a pool reference\n // would stop it from being disposed on resize.\n bindTextures: (out) => {\n out.push({ texture: texture().sampledTexture });\n },\n getCustomCode: (stage) => (stage === \"fragment\" ? fragment : null),\n };\n}\n\n/**\n * Builds the GTAO pass, splices its tasks in after the scene inputs, and returns its handle.\n *\n * @remarks\n * Called once, from the renderer, with a scene-inputs lease the handle now owns. Before the scene is\n * registered (`isFrameGraphBuilt` `false`) `registerScene` records the tasks; afterwards they are\n * recorded here.\n *\n * @param engine - The engine.\n * @param scene - The render scene.\n * @param inputs - A scene-inputs lease; released by {@link AmbientOcclusion.dispose}.\n * @param options - The resolved settings.\n * @param isFrameGraphBuilt - Whether the scene is registered.\n * @returns The handle.\n *\n * @internal\n */\nexport async function createAmbientOcclusion(\n engine: EngineContext,\n scene: SceneContext,\n inputs: SceneInputs,\n options: AmbientOcclusionOptions,\n isFrameGraphBuilt: boolean,\n): Promise<AmbientOcclusion> {\n const shape = gtaoShape(options.quality);\n let current = await buildGpuSet(engine, inputs, shape);\n const retired: { set: GpuSet; frames: number }[] = [];\n const data = new Float32Array(UNIFORM_FLOATS);\n let isDisposed = false;\n let generation = 0;\n\n const compute: ComputeTask = createComputeTask(engine, GTAO_TASK_NAMES.compute);\n addComputeDispatch(compute, current.gtao);\n addComputeDispatch(compute, current.denoise);\n const params = createExecuteTask(engine, scene, GTAO_TASK_NAMES.params, () => {\n const enabled = writeParams(scene, current, shape, options, data);\n current.gtao.enabled = enabled;\n current.denoise.enabled = enabled;\n if (enabled) {\n updateUniformBuffer(engine, current.uniforms, data);\n }\n });\n const tasks: readonly Task[] = [params, compute];\n const pyramid = frameGraphTasks(scene)?.find((task) => task.name === SCENE_INPUT_TASK_NAMES.depthPyramid);\n if (pyramid === undefined) {\n disposeGpuSet(current);\n inputs.release();\n throw new Error(\"GTAO needs the scene inputs' depth pyramid task in the frame graph.\");\n }\n addTaskAfter(scene, params, pyramid);\n addTaskAfter(scene, compute, params);\n if (isFrameGraphBuilt) {\n const graph = getFrameGraph(scene);\n for (const task of tasks) {\n buildFrameGraphTask(graph, task);\n }\n }\n\n const plugin = createAmbientOcclusionPlugin(shape.scale, () => current.out);\n const stopWatch = inputs.onChange(() => {\n generation += 1;\n const mine = generation;\n // The pyramid and the input textures were replaced; the bindings name freed ones.\n compute.executionEnabled = false;\n buildGpuSet(engine, inputs, shape).then(\n (next) => {\n if (isDisposed || mine !== generation) {\n disposeGpuSet(next);\n return;\n }\n removeComputeDispatch(compute, current.gtao);\n removeComputeDispatch(compute, current.denoise);\n addComputeDispatch(compute, next.gtao);\n addComputeDispatch(compute, next.denoise);\n retired.push({ set: current, frames: RETIRE_FRAMES });\n current = next;\n compute.executionEnabled = true;\n rebuildPatchedMaterials(scene, plugin);\n },\n (error: unknown) => {\n options.onError(error);\n },\n );\n });\n\n return {\n get texture(): ComputeStorageTexture2D {\n return current.out;\n },\n update(isSceneRegistered: boolean): void {\n if (isDisposed) {\n return;\n }\n attachPlugin(scene, plugin, isSceneRegistered);\n for (let index = retired.length - 1; index >= 0; index -= 1) {\n const entry = retired[index];\n if (entry !== undefined && --entry.frames <= 0) {\n disposeGpuSet(entry.set);\n retired.splice(index, 1);\n }\n }\n },\n dispose(): void {\n if (isDisposed) {\n return;\n }\n isDisposed = true;\n stopWatch();\n const list = frameGraphTasks(scene);\n for (const task of tasks) {\n // Disable first: a disposed task that still executes is a use-after-free.\n task.executionEnabled = false;\n const index = list?.indexOf(task) ?? -1;\n if (list !== null && index >= 0) {\n list.splice(index, 1);\n }\n task.dispose();\n }\n disposeGpuSet(current);\n for (const entry of retired) {\n disposeGpuSet(entry.set);\n }\n retired.length = 0;\n inputs.release();\n },\n };\n}\n\n/**\n * Writes this frame's uniforms from the scene's camera.\n *\n * @param scene - The scene.\n * @param set - The current GPU set, for its sizes.\n * @param shape - The quality's shape.\n * @param options - The settings.\n * @param out - The uniform floats.\n * @returns `false` when there is no camera or its projection does not invert, so the pass skips.\n */\nfunction writeParams(\n scene: SceneContext,\n set: GpuSet,\n shape: GtaoShape,\n options: AmbientOcclusionOptions,\n out: Float32Array,\n): boolean {\n const camera = scene.camera;\n if (camera === null) {\n return false;\n }\n const projection = getProjectionMatrix(camera, getEffectiveAspectRatio(camera, set.width, set.height));\n const inverse = invertMat4(projection);\n if (inverse === null) {\n return false;\n }\n copyMat4(projection, out, 0);\n copyMat4(inverse, out, 16);\n copyMat4(getViewMatrix(camera), out, 32);\n out[48] = set.width;\n out[49] = set.height;\n out[50] = set.raw.width;\n out[51] = set.raw.height;\n out[52] = options.radius;\n out[53] = options.falloff;\n out[54] = options.intensity;\n out[55] = shape.slices;\n return true;\n}\n\n/**\n * Copies a Lite matrix into a float array.\n *\n * @param matrix - The matrix, column-major.\n * @param out - The destination.\n * @param offset - Where the 16 floats start.\n */\nfunction copyMat4(matrix: Mat4, out: Float32Array, offset: number): void {\n for (let index = 0; index < 16; index += 1) {\n out[offset + index] = matrix[index] ?? 0;\n }\n}\n\n/**\n * Creates the textures, shaders and bindings for the current surface size and device.\n *\n * @param engine - The engine.\n * @param inputs - The scene-inputs lease.\n * @param shape - The quality's shape.\n * @returns The set.\n */\nasync function buildGpuSet(engine: EngineContext, inputs: SceneInputs, shape: GtaoShape): Promise<GpuSet> {\n const width = inputs.depth.width;\n const height = inputs.depth.height;\n const aoWidth = Math.max(1, Math.ceil(width / shape.scale));\n const aoHeight = Math.max(1, Math.ceil(height / shape.scale));\n const [pyramid, normals] = await Promise.all([\n createComputeTextureResource(engine, inputs.depthPyramid, { sampleType: \"unfilterable-float\" }),\n createComputeTextureResource(engine, inputs.normals, { sampleType: \"unfilterable-float\" }),\n ]);\n const uniforms = createUniformBuffer(engine, UNIFORM_FLOATS * 4, { label: \"ignifx:gtao-params\" });\n const raw = createComputeStorageTexture2D(engine, {\n width: aoWidth,\n height: aoHeight,\n format: \"rgba16float\",\n label: \"ignifx:gtao-raw\",\n invertY: false,\n });\n const out = createComputeStorageTexture2D(engine, {\n width: aoWidth,\n height: aoHeight,\n format: \"rgba8unorm\",\n label: \"ignifx:gtao\",\n invertY: false,\n });\n const gtaoShader = createComputeShader(engine, {\n name: \"ignifx:gtao\",\n computeSource: gtaoWgsl(shape),\n bindings: [\n computeUniformBufferBinding(\"params\", { group: 0, binding: 0 }),\n computeTextureBinding(\"depthPyramid\", { group: 0, binding: 1, sampleType: \"unfilterable-float\" }),\n computeTextureBinding(\"normals\", { group: 0, binding: 2, sampleType: \"unfilterable-float\" }),\n computeStorageTextureBinding(\"aoOut\", { group: 0, binding: 3, format: \"rgba16float\" }),\n ],\n });\n const denoiseShader = createComputeShader(engine, {\n name: \"ignifx:gtao-denoise\",\n computeSource: gtaoDenoiseWgsl(),\n bindings: [\n computeUniformBufferBinding(\"params\", { group: 0, binding: 0 }),\n computeTextureBinding(\"rawAo\", { group: 0, binding: 1, sampleType: \"float\" }),\n computeStorageTextureBinding(\"aoOut\", { group: 0, binding: 2, format: \"rgba8unorm\" }),\n ],\n });\n const size = { x: Math.ceil(aoWidth / WORKGROUP), y: Math.ceil(aoHeight / WORKGROUP) };\n const gtao = createComputeDispatch(\n gtaoShader,\n createComputeBindingSet(gtaoShader, { params: uniforms, depthPyramid: pyramid, normals, aoOut: raw }),\n { size, enabled: false },\n );\n const denoise = createComputeDispatch(\n denoiseShader,\n createComputeBindingSet(denoiseShader, { params: uniforms, rawAo: raw.computeTexture, aoOut: out }),\n { size, enabled: false },\n );\n return { uniforms, raw, out, shaders: [gtaoShader, denoiseShader], gtao, denoise, width, height };\n}\n\n/**\n * Frees a set's GPU objects.\n *\n * @param set - The set.\n */\nfunction disposeGpuSet(set: GpuSet): void {\n set.gtao.enabled = false;\n set.denoise.enabled = false;\n disposeComputeBindingSet(set.gtao.bindings);\n disposeComputeBindingSet(set.denoise.bindings);\n for (const shader of set.shaders) {\n disposeComputeShader(shader);\n }\n disposeComputeStorageTexture2D(set.raw);\n disposeComputeStorageTexture2D(set.out);\n disposeUniformBuffer(set.uniforms);\n}\n\n/**\n * Creates a frame-graph task that runs a callback each frame, inside the frame graph.\n *\n * @remarks\n * Lite runs a task's `execute()` fast path instead of its recorded passes\n * (`lib/frame-graph/frame-graph.js`); `record()` and `build()` clear and walk `_passes`, which such\n * a task leaves empty. It runs after Lite's per-frame world-matrix update, unlike `onBeforeRender`.\n *\n * @param engine - The engine.\n * @param scene - The scene.\n * @param name - The task name.\n * @param run - The callback.\n * @returns The task.\n */\nfunction createExecuteTask(engine: EngineContext, scene: SceneContext, name: string, run: () => void): Task {\n const task = {\n name,\n engine,\n scene,\n executionEnabled: true,\n // oxlint-disable-next-line no-underscore-dangle\n _passes: [] as unknown[],\n record(): void {\n // Nothing to record: the work happens in `execute`.\n },\n execute(): number {\n run();\n return 0;\n },\n dispose(): void {\n // Owns nothing.\n },\n };\n return task;\n}\n\n/**\n * Gives every lit PBR material in the scene the AO plugin, once.\n *\n * @remarks\n * A walk, for the reasons `./hdr-output.ts`'s `attachLinearOutput` gives: materials come from many\n * places, and a surface shader replaces a material's plugin list.\n *\n * @param scene - The scene.\n * @param plugin - The shared plugin.\n * @param isSceneRegistered - Whether a patched material's pipelines must be rebuilt.\n */\nfunction attachPlugin(scene: SceneContext, plugin: MaterialPlugin, isSceneRegistered: boolean): void {\n const meshes = scene.meshes;\n for (let index = 0; index < meshes.length; index += 1) {\n const material = meshes[index]?.material;\n // Declared non-null, but Lite's mesh factories create meshes with `material: null`.\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (material === undefined || material === null || !isPbrMaterial(material)) {\n continue;\n }\n if (getPbrUnlit(material) !== undefined) {\n continue;\n }\n const current = material.plugins ?? [];\n if (current.includes(plugin)) {\n continue;\n }\n material.plugins = [...current, plugin];\n if (isSceneRegistered) {\n rebuildMaterialPipelines(scene, material);\n }\n }\n}\n\n/**\n * Rebuilds every material that carries the plugin, so its bind group names the new AO texture.\n *\n * @param scene - The scene.\n * @param plugin - The shared plugin.\n */\nfunction rebuildPatchedMaterials(scene: SceneContext, plugin: MaterialPlugin): void {\n const seen = new Set<Material>();\n const meshes = scene.meshes;\n for (let index = 0; index < meshes.length; index += 1) {\n const material = meshes[index]?.material;\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (material === undefined || material === null || seen.has(material) || !isPbrMaterial(material)) {\n continue;\n }\n seen.add(material);\n if (material.plugins?.includes(plugin) === true) {\n rebuildMaterialPipelines(scene, material);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,kBAAkB;CAAE,QAAQ;CAAsB,SAAS;AAAc;;;;;;AAOtF,MAAa,mBAAmB;;AAGhC,MAAM,iBAAiB;;AAGvB,MAAM,gBAAgB;;AAGtB,MAAM,YAAY;;;;;;;;;AA4ClB,SAAgB,UAAU,SAAqC;CAC7D,OAAO,YAAY,SACf;EAAE,OAAO;EAAG,SAAS;EAAG,QAAQ;EAAG,OAAO;CAAE,IAC5C;EAAE,OAAO;EAAG,SAAS;EAAG,QAAQ;EAAG,OAAO;CAAE;AAClD;;;;;;;;;AAyCA,SAAgB,SAAS,OAA0B;CACjD,OAAO;;;;;;;;;;;;;sBAaa,OAAO,MAAM,MAAM,EAAE;qBACtB,OAAO,MAAM,KAAK,EAAE;wBACjB,OAAO,MAAM,OAAO,EAAE;qBACzB,MAAM,MAAM,QAAQ,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;2BAoBjB,OAAO,SAAS,EAAE,IAAI,OAAO,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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I,aAAa,KAAA,KAAa,aAAa,QAAQ,CAAC,cAAc,QAAQ,GACxE;EAEF,IAAI,YAAY,QAAQ,MAAM,KAAA,GAC5B;EAEF,MAAM,UAAU,SAAS,WAAW,CAAC;EACrC,IAAI,QAAQ,SAAS,MAAM,GACzB;EAEF,SAAS,UAAU,CAAC,GAAG,SAAS,MAAM;EACtC,IAAI,mBACF,yBAAyB,OAAO,QAAQ;CAE5C;AACF;;;;;;;AAQA,SAAS,wBAAwB,OAAqB,QAA8B;CAClF,MAAM,uBAAO,IAAI,IAAc;CAC/B,MAAM,SAAS,MAAM;CACrB,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACrD,MAAM,WAAW,OAAO,MAAM,EAAE;EAEhC,IAAI,aAAa,KAAA,KAAa,aAAa,QAAQ,KAAK,IAAI,QAAQ,KAAK,CAAC,cAAc,QAAQ,GAC9F;EAEF,KAAK,IAAI,QAAQ;EACjB,IAAI,SAAS,SAAS,SAAS,MAAM,MAAM,MACzC,yBAAyB,OAAO,QAAQ;CAE5C;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as EASING_NAMES, $a as JsonSchemaObject, $i as LitePbrMaterial, $n as CANVAS_ALPHA_MODES, $o as FieldOptions, $r as STANDARD_TEXTURE_SLOTS, $s as CORE_ERROR_MESSAGES, $t as EntityPrefabLink, A as PHASE_NAMES, Aa as encodeProps, Ai as SHADER_BLEND_MODES, An as FrameWaitOptions, Ao as Vec4Like, Ar as TorusMeshOptions, As as LoadOptions, At as HotReloadReport, B as SystemContext, Ba as SCENE_FILE_FORMAT, Bi as ShaderCullMode, Bn as RenderTaskTimings, Bo as BoolFieldSpec, Br as createLightmapAsset, Bs as SignalOwner, Bt as resetFrameSample, C as DeviceLostInfo, Ca as UidRemap, Ci as SHADER_FILE_EXTENSIONS, Cn as MAT4_IDENTITY, Co as MutableQuat, Cr as MeshAsset, Cs as AssetRef, Ct as LogSink, D as FrameState, Da as canonicalizeNumber, Di as LITE_SYSTEM_UNIFORM_NAMES, Dn as RENDER_TEXTURE_MAX_SIZE, Do as QuatLike, Dr as MeshPrimitiveDefinition, Ds as AssetsSettings, Dt as HotReloadModule, E as ExtensionContext, Ea as ReferenceEncoder, Ei as IgnifxUniformName, En as EDITOR_ONLY_METADATA_KEY, Eo as MutableVec4, Er as MeshPrimitive, Es as Assets, Et as HotReloadKind, F as ServiceKey, Fa as SceneAssetToken, Fi as SHADER_UNIFORM_TYPES, Fn as RenderOverlayLiteHandles, Fo as ScriptClassInfo, Fr as LIGHTMAP_FILE_FORMAT, Fs as Disconnect, Ft as ProfileScope, G as createServiceKey, Ga as SceneFileEntity, Gi as ShaderPipelineState, Gn as RenderSurface, Go as CurveKey, Gr as MATERIAL_FORMAT_VERSION, Gs as LiteScene, Gt as ComponentStatics, H as Time, Ha as SceneFile, Hi as ShaderDefineDeclaration, Hn as RendererImpl, Ho as ComponentRefFieldSpec, Hr as MATERIAL_ASSET_TYPE, Hs as JsonObject, Ht as createDiagnosticsGroup, I as ServiceNameKey, Ia as computeSceneHash, Ii as SURFACE_HOOK_NAMES, In as RenderPick, Io as ArrayFieldSpec, Ir as LIGHTMAP_FORMAT_VERSION, Is as Signal, It as FrameSample, J as Tweens, Ja as SceneFileTransform, Ji as ShaderTextureFallback, Jn as SHADOW_TECHNIQUES, Jo as CustomFieldSpec, Jr as MaterialAssetLiteHandles, Js as IgnifxError, Jt as ScriptStatics, K as TweenProps, Ka as SceneFileInstance, Ki as ShaderStorageDeclaration, Kn as isWebGpuAvailable, Ko as CurveValue, Kr as MATERIAL_KINDS, Ks as ErrorContext, Kt as ComponentType, L as ServiceRegistry, La as createSceneAsset, Li as SURFACE_UNIFORM_BLOCK, Ln as RenderPickIgnore, Lo as AssetFieldSpec, Lr as LightmapAsset, Ls as SignalHandler, Lt as PHASE_COUNT, M as RegisterComponentOptions, Ma as SchemaIssue, Mi as SHADER_INSTANCING_MODES, Mn as RENDER_DIAGNOSTICS_GROUP, Mo as ComponentClassInfo, Mr as IDENTITY_LIGHTMAP_PLACEMENT, Ms as RegisterAssetOptions, Mt as Diagnostics, N as RegisterSystemOptions, Na as SchemaIssueCode, Ni as SHADER_KINDS, Nn as RenderCapture, No as ComponentRegistry, Nr as LIGHTMAP_ASSET_TYPE, Ns as ConnectOptions, Nt as DiagnosticsOptions, O as LayersSettings, Oa as decodeProps, Oi as LiteSystemUniformName, On as RenderTexture, Oo as Vec2Like, Or as PlaneMeshOptions, Os as BatchHandle, Ot as HotReloadOptions, P as ServiceClassKey, Pa as SceneAsset, Pi as SHADER_TEXTURE_FALLBACKS, Pn as RenderOverlay, Po as ComponentReplacement, Pr as LIGHTMAP_FILE_EXTENSIONS, Ps as DeferredQueue, Pt as FRAME_HISTORY_LENGTH, Q as EASINGS, Qa as stringifySceneFile, Qi as LiteMaterial, Qn as AutoExposureSettings, Qo as FieldKind, Qr as PbrMaterialDefinition, Qs as isIgnifxError, Qt as Entity, R as SortingLayersSettings, Ra as SCENE_ASSET_TYPE, Ri as ShaderAttributeName, Rn as RenderPickOptions, Ro as AssetRefValue, Rr as LightmapFileData, Rs as SignalLike, Rt as PhaseIndex, S as CoroutineYield, Sa as SceneInstance, Si as SHADER_ASSET_TYPE, Sn as createRay, So as Mat4Like, Sr as MESH_PRIMITIVES, Ss as AssetProgress, St as LogRecord, T as Extension, Ta as ReferenceDecoder, Ti as IGNIFX_UNIFORM_NAMES, Tn as Mat4Elements, To as MutableVec3, Tr as MeshGeometryData, Ts as AssetTypeDefinition, Tt as HotReloadHost, U as TimeSettings, Ua as SceneFileAssetRef, Ui as ShaderInstancingMode, Un as RenderingFeature, Uo as ComponentTypeToken, Ur as MATERIAL_FILE_EXTENSION, Us as JsonValue, Ut as ComponentInit, V as SystemEditMode, Va as SCENE_FORMAT_VERSION, Vi as ShaderDeclaration, Vn as Renderer, Vo as ColorFieldSpec, Vr as writeLightmapFile, Vs as JsonArray, Vt as DiagnosticsGroup, W as WaitInstruction, Wa as SceneFileComponent, Wi as ShaderKind, Wn as forceRendererDeviceLossForTesting, Wo as CurveFieldSpec, Wr as MATERIAL_FILE_FORMAT, Ws as LiteEngine, Wt as ComponentInitValue, X as Tween, Xa as isSceneFileHeader, Xi as ShaderUniformType, Xn as AmbientOcclusionQuality, Xo as EnumFieldSpec, Xr as MaterialKind, Xs as assertNever, Xt as ComponentDefinition, Y as TWEEN_LOOP_FOREVER, Ya as describeSceneFileFormat, Yi as ShaderUniformDeclaration, Yn as AMBIENT_OCCLUSION_QUALITIES, Yo as EntityRefFieldSpec, Yr as MaterialDefinition, Ys as IgnifxErrorOptions, Yt as Component, Z as TweenOptions, Za as sceneFileJsonSchema, Zi as SurfaceHookName, Zn as AmbientOcclusionSettings, Zo as FieldDefinition, Zr as PBR_TEXTURE_SLOTS, Zs as formatErrorMessage, Zt as ComponentHooks, _ as AppLiteHandles, _a as createLayerTable, _i as TEXTURE_ASSET_TYPE, _n as Camera, _o as VEC2_ZERO, _r as BoxMeshOptions, _s as AssetLoadError, _t as Logger, a as PrefabOverrideSkip, aa as LIGHT_PROBE_FILE_EXTENSIONS, ai as SurfaceShaderInit, an as LoadSceneFileOptions, ao as Transform, ar as RenderingQuality, as as OptionalFieldSpec, at as TweenableValue, b as CoroutineHandle, ba as ScriptCallbacks, bi as TextureImportOptions, bn as Ray, bo as Quat, br as GroundMeshOptions, bs as AssetManifest, bt as LOG_LEVEL_SEVERITY, c as EntityOverrideField, ca as LightProbeAsset, ci as STORAGE_BUFFER_ASSET_TYPE, cn as WorldLiteHandles, co as VEC3_DOWN, cr as defaultAutoExposureSettings, cs as Schema, ct as StorageBackend, d as InstanceTarget, da as sampleLightProbes, di as createStorageBufferAsset, dn as InstantiateSceneOptions, do as VEC3_ONE, dr as ReflectionProbe, ds as PhysicsCallbackName, dt as GpuAdapterInfo, ea as LiteStandardMaterial, ec as CoreErrorCode, ei as StandardMaterialDefinition, en as SetParentOptions, eo as SchemaDescription, er as CanvasAlphaMode, es as FieldSpec, et as EasingFunction, f as PrefabReader, fa as writeLightProbeFile, fi as LiteStorageBuffer, fn as SceneBuildResult, fo as VEC3_RIGHT, fr as ReflectionProbeRefreshMode, fs as ScriptCallbackKind, ft as PlatformInfo, g as AppEvents, ga as RESERVED_LAYER_NAMES, gi as PixelTextureOptions, gn as instantiateScene, go as VEC2_ONE, gr as MeshRendererLightmap, gs as AssetHandle, gt as platformInternals, h as App, ha as MAX_LAYERS, hi as shaderMaterialDefinition, hn as assertSceneDependenciesLoaded, ho as Vec3, hr as MeshRenderer, hs as INVALID_HANDLE, ht as WebGpuInfo, i as PrefabOverrideSelection, ia as LIGHT_PROBE_ASSET_TYPE, ic as isValidErrorCode, ii as SurfaceShaderBinding, in as LoadProgress, io as toJsonSchema, ir as RenderingFeatureSettings, is as NumberFieldSpec, it as TweenValueKind, j as Phase, ja as encodeValue, ji as SHADER_CULL_MODES, jn as RENDER_DIAGNOSTICS_COUNTERS, jo as TagSet, jr as LiteMesh, js as LoaderContext, jt as HotReloadStatics, k as PHASES, ka as decodeValue, ki as SHADER_ATTRIBUTE_NAMES, kn as LiteCamera, ko as Vec3Like, kr as SphereMeshOptions, ks as FetchLike, kt as HotReloadPolicy, l as OverridePath, la as LightProbeData, li as StorageBufferAsset, ln as AddComponentFromRecordOptions, lo as VEC3_FORWARD, lr as defaultRenderingSettings, ls as StringFieldSpec, lt as StoredValue, m as resolveInstancePath, ma as LayerTable, mi as ShaderMaterialDefinitionInput, mn as addComponentFromRecord, mo as VEC3_ZERO, mr as LightmapMode, ms as EntityHandle, mt as PlatformOs, n as PrefabApplyResult, na as MaterialAlphaMode, nc as ErrorRange, ni as pbrMaterialDefinition, nn as CreateSceneOptions, no as SchemaFieldDescription, nr as RENDERING_QUALITIES, ns as LayerMaskFieldSpec, nt as resolveEase, o as applyOverridesToAsset, oa as LIGHT_PROBE_FILE_FORMAT, oi as SurfaceShaderReference, on as LoadSceneOptions, oo as LiteSceneNode, or as RenderingSettings, os as PartialFieldsOf, ot as Storage, p as enumerateInstanceTargets, pa as DEFAULT_LAYER, pi as ShaderMaterialDefinition, pn as SceneLoadIssue, po as VEC3_UP, pr as LIGHTMAP_MODES, ps as ComponentHandle, pt as PlatformKind, q as TweenTargetValue, qa as SceneFileOverride, qi as ShaderTextureDeclaration, qn as LiteShadowGenerator, qo as CustomFieldCodec, qr as MaterialAsset, qs as ErrorFormatMode, qt as ConcreteComponentType, r as PrefabComponentSkip, ra as LightProbeVolume, rc as THIRD_PARTY_ERROR_PREFIX, ri as standardMaterialDefinition, rn as InstantiateOptions, ro as describeSchema, rr as RENDERING_SETTINGS_SECTION, rs as MapFieldSpec, rt as TWEEN_VALUE_KINDS, s as revertOverrides, sa as LIGHT_PROBE_FORMAT_VERSION, si as LiteShaderMaterial, sn as World, so as VEC3_BACKWARD, sr as TaaSettings, ss as RecordFieldSpec, st as storageInternals, t as PrefabApplyOptions, ta as MATERIAL_ALPHA_MODES, tc as ErrorCode, ti as createMaterialAsset, tn as CreateEntityOptions, to as SchemaDescriptionMeta, tr as DEFAULT_BRDF_LUT_ADDRESS, ts as FieldsOf, tt as EasingName, u as parseOverridePath, ua as createLightProbeAsset, ui as StorageBufferAssetLiteHandles, un as ComponentBuildResult, uo as VEC3_LEFT, ur as REFLECTION_PROBE_REFRESH_MODES, us as VectorFieldSpec, ut as StoredValueKind, v as AppSettings, va as LayerMask, vi as TextureAsset, vn as CameraProjection, vo as Vec2, vr as CapsuleMeshOptions, vs as AssetLoadErrorOptions, vt as LoggerOptions, w as ErrorReport, wa as DecodeResult, wi as ShaderAsset, wn as Mat4, wo as MutableVec2, wr as MeshAssetLiteHandles, ws as AssetState, wt as LogThreshold, x as CoroutineHost, xa as ScriptDefinition, xi as LiteTexture2D, xn as RayVector, xo as ColorLike, xr as MESH_ASSET_TYPE, xs as AssetManifestEntry, xt as LogLevel, y as Coroutine, ya as Script, yi as TextureAssetLiteHandles, yn as PROJECTIONS, yo as QUAT_IDENTITY, yr as CylinderMeshOptions, ys as AssetLoader, yt as createLogger, z as System, za as SCENE_FILE_EXTENSIONS, zi as ShaderBlendMode, zn as RenderTaskTiming, zo as AssetTypeToken, zr as LightmapPlacement, zs as SignalOptions, zt as createFrameSample } from "./prefab-overrides-DwrPDVVt.js";
1
+ import { $ as EASING_NAMES, $a as JsonSchemaObject, $i as LitePbrMaterial, $n as CANVAS_ALPHA_MODES, $o as FieldOptions, $r as STANDARD_TEXTURE_SLOTS, $s as CORE_ERROR_MESSAGES, $t as EntityPrefabLink, A as PHASE_NAMES, Aa as encodeProps, Ai as SHADER_BLEND_MODES, An as FrameWaitOptions, Ao as Vec4Like, Ar as TorusMeshOptions, As as LoadOptions, At as HotReloadReport, B as SystemContext, Ba as SCENE_FILE_FORMAT, Bi as ShaderCullMode, Bn as RenderTaskTimings, Bo as BoolFieldSpec, Br as createLightmapAsset, Bs as SignalOwner, Bt as resetFrameSample, C as DeviceLostInfo, Ca as UidRemap, Ci as SHADER_FILE_EXTENSIONS, Cn as MAT4_IDENTITY, Co as MutableQuat, Cr as MeshAsset, Cs as AssetRef, Ct as LogSink, D as FrameState, Da as canonicalizeNumber, Di as LITE_SYSTEM_UNIFORM_NAMES, Dn as RENDER_TEXTURE_MAX_SIZE, Do as QuatLike, Dr as MeshPrimitiveDefinition, Ds as AssetsSettings, Dt as HotReloadModule, E as ExtensionContext, Ea as ReferenceEncoder, Ei as IgnifxUniformName, En as EDITOR_ONLY_METADATA_KEY, Eo as MutableVec4, Er as MeshPrimitive, Es as Assets, Et as HotReloadKind, F as ServiceKey, Fa as SceneAssetToken, Fi as SHADER_UNIFORM_TYPES, Fn as RenderOverlayLiteHandles, Fo as ScriptClassInfo, Fr as LIGHTMAP_FILE_FORMAT, Fs as Disconnect, Ft as ProfileScope, G as createServiceKey, Ga as SceneFileEntity, Gi as ShaderPipelineState, Gn as RenderSurface, Go as CurveKey, Gr as MATERIAL_FORMAT_VERSION, Gs as LiteScene, Gt as ComponentStatics, H as Time, Ha as SceneFile, Hi as ShaderDefineDeclaration, Hn as RendererImpl, Ho as ComponentRefFieldSpec, Hr as MATERIAL_ASSET_TYPE, Hs as JsonObject, Ht as createDiagnosticsGroup, I as ServiceNameKey, Ia as computeSceneHash, Ii as SURFACE_HOOK_NAMES, In as RenderPick, Io as ArrayFieldSpec, Ir as LIGHTMAP_FORMAT_VERSION, Is as Signal, It as FrameSample, J as Tweens, Ja as SceneFileTransform, Ji as ShaderTextureFallback, Jn as SHADOW_TECHNIQUES, Jo as CustomFieldSpec, Jr as MaterialAssetLiteHandles, Js as IgnifxError, Jt as ScriptStatics, K as TweenProps, Ka as SceneFileInstance, Ki as ShaderStorageDeclaration, Kn as isWebGpuAvailable, Ko as CurveValue, Kr as MATERIAL_KINDS, Ks as ErrorContext, Kt as ComponentType, L as ServiceRegistry, La as createSceneAsset, Li as SURFACE_UNIFORM_BLOCK, Ln as RenderPickIgnore, Lo as AssetFieldSpec, Lr as LightmapAsset, Ls as SignalHandler, Lt as PHASE_COUNT, M as RegisterComponentOptions, Ma as SchemaIssue, Mi as SHADER_INSTANCING_MODES, Mn as RENDER_DIAGNOSTICS_GROUP, Mo as ComponentClassInfo, Mr as IDENTITY_LIGHTMAP_PLACEMENT, Ms as RegisterAssetOptions, Mt as Diagnostics, N as RegisterSystemOptions, Na as SchemaIssueCode, Ni as SHADER_KINDS, Nn as RenderCapture, No as ComponentRegistry, Nr as LIGHTMAP_ASSET_TYPE, Ns as ConnectOptions, Nt as DiagnosticsOptions, O as LayersSettings, Oa as decodeProps, Oi as LiteSystemUniformName, On as RenderTexture, Oo as Vec2Like, Or as PlaneMeshOptions, Os as BatchHandle, Ot as HotReloadOptions, P as ServiceClassKey, Pa as SceneAsset, Pi as SHADER_TEXTURE_FALLBACKS, Pn as RenderOverlay, Po as ComponentReplacement, Pr as LIGHTMAP_FILE_EXTENSIONS, Ps as DeferredQueue, Pt as FRAME_HISTORY_LENGTH, Q as EASINGS, Qa as stringifySceneFile, Qi as LiteMaterial, Qn as AutoExposureSettings, Qo as FieldKind, Qr as PbrMaterialDefinition, Qs as isIgnifxError, Qt as Entity, R as SortingLayersSettings, Ra as SCENE_ASSET_TYPE, Ri as ShaderAttributeName, Rn as RenderPickOptions, Ro as AssetRefValue, Rr as LightmapFileData, Rs as SignalLike, Rt as PhaseIndex, S as CoroutineYield, Sa as SceneInstance, Si as SHADER_ASSET_TYPE, Sn as createRay, So as Mat4Like, Sr as MESH_PRIMITIVES, Ss as AssetProgress, St as LogRecord, T as Extension, Ta as ReferenceDecoder, Ti as IGNIFX_UNIFORM_NAMES, Tn as Mat4Elements, To as MutableVec3, Tr as MeshGeometryData, Ts as AssetTypeDefinition, Tt as HotReloadHost, U as TimeSettings, Ua as SceneFileAssetRef, Ui as ShaderInstancingMode, Un as RenderingFeature, Uo as ComponentTypeToken, Ur as MATERIAL_FILE_EXTENSION, Us as JsonValue, Ut as ComponentInit, V as SystemEditMode, Va as SCENE_FORMAT_VERSION, Vi as ShaderDeclaration, Vn as Renderer, Vo as ColorFieldSpec, Vr as writeLightmapFile, Vs as JsonArray, Vt as DiagnosticsGroup, W as WaitInstruction, Wa as SceneFileComponent, Wi as ShaderKind, Wn as forceRendererDeviceLossForTesting, Wo as CurveFieldSpec, Wr as MATERIAL_FILE_FORMAT, Ws as LiteEngine, Wt as ComponentInitValue, X as Tween, Xa as isSceneFileHeader, Xi as ShaderUniformType, Xn as AmbientOcclusionQuality, Xo as EnumFieldSpec, Xr as MaterialKind, Xs as assertNever, Xt as ComponentDefinition, Y as TWEEN_LOOP_FOREVER, Ya as describeSceneFileFormat, Yi as ShaderUniformDeclaration, Yn as AMBIENT_OCCLUSION_QUALITIES, Yo as EntityRefFieldSpec, Yr as MaterialDefinition, Ys as IgnifxErrorOptions, Yt as Component, Z as TweenOptions, Za as sceneFileJsonSchema, Zi as SurfaceHookName, Zn as AmbientOcclusionSettings, Zo as FieldDefinition, Zr as PBR_TEXTURE_SLOTS, Zs as formatErrorMessage, Zt as ComponentHooks, _ as AppLiteHandles, _a as createLayerTable, _i as TEXTURE_ASSET_TYPE, _n as Camera, _o as VEC2_ZERO, _r as BoxMeshOptions, _s as AssetLoadError, _t as Logger, a as PrefabOverrideSkip, aa as LIGHT_PROBE_FILE_EXTENSIONS, ai as SurfaceShaderInit, an as LoadSceneFileOptions, ao as Transform, ar as RenderingQuality, as as OptionalFieldSpec, at as TweenableValue, b as CoroutineHandle, ba as ScriptCallbacks, bi as TextureImportOptions, bn as Ray, bo as Quat, br as GroundMeshOptions, bs as AssetManifest, bt as LOG_LEVEL_SEVERITY, c as EntityOverrideField, ca as LightProbeAsset, ci as STORAGE_BUFFER_ASSET_TYPE, cn as WorldLiteHandles, co as VEC3_DOWN, cr as defaultAutoExposureSettings, cs as Schema, ct as StorageBackend, d as InstanceTarget, da as sampleLightProbes, di as createStorageBufferAsset, dn as InstantiateSceneOptions, do as VEC3_ONE, dr as ReflectionProbe, ds as PhysicsCallbackName, dt as GpuAdapterInfo, ea as LiteStandardMaterial, ec as CoreErrorCode, ei as StandardMaterialDefinition, en as SetParentOptions, eo as SchemaDescription, er as CanvasAlphaMode, es as FieldSpec, et as EasingFunction, f as PrefabReader, fa as writeLightProbeFile, fi as LiteStorageBuffer, fn as SceneBuildResult, fo as VEC3_RIGHT, fr as ReflectionProbeRefreshMode, fs as ScriptCallbackKind, ft as PlatformInfo, g as AppEvents, ga as RESERVED_LAYER_NAMES, gi as PixelTextureOptions, gn as instantiateScene, go as VEC2_ONE, gr as MeshRendererLightmap, gs as AssetHandle, gt as platformInternals, h as App, ha as MAX_LAYERS, hi as shaderMaterialDefinition, hn as assertSceneDependenciesLoaded, ho as Vec3, hr as MeshRenderer, hs as INVALID_HANDLE, ht as WebGpuInfo, i as PrefabOverrideSelection, ia as LIGHT_PROBE_ASSET_TYPE, ic as isValidErrorCode, ii as SurfaceShaderBinding, in as LoadProgress, io as toJsonSchema, ir as RenderingFeatureSettings, is as NumberFieldSpec, it as TweenValueKind, j as Phase, ja as encodeValue, ji as SHADER_CULL_MODES, jn as RENDER_DIAGNOSTICS_COUNTERS, jo as TagSet, jr as LiteMesh, js as LoaderContext, jt as HotReloadStatics, k as PHASES, ka as decodeValue, ki as SHADER_ATTRIBUTE_NAMES, kn as LiteCamera, ko as Vec3Like, kr as SphereMeshOptions, ks as FetchLike, kt as HotReloadPolicy, l as OverridePath, la as LightProbeData, li as StorageBufferAsset, ln as AddComponentFromRecordOptions, lo as VEC3_FORWARD, lr as defaultRenderingSettings, ls as StringFieldSpec, lt as StoredValue, m as resolveInstancePath, ma as LayerTable, mi as ShaderMaterialDefinitionInput, mn as addComponentFromRecord, mo as VEC3_ZERO, mr as LightmapMode, ms as EntityHandle, mt as PlatformOs, n as PrefabApplyResult, na as MaterialAlphaMode, nc as ErrorRange, ni as pbrMaterialDefinition, nn as CreateSceneOptions, no as SchemaFieldDescription, nr as RENDERING_QUALITIES, ns as LayerMaskFieldSpec, nt as resolveEase, o as applyOverridesToAsset, oa as LIGHT_PROBE_FILE_FORMAT, oi as SurfaceShaderReference, on as LoadSceneOptions, oo as LiteSceneNode, or as RenderingSettings, os as PartialFieldsOf, ot as Storage, p as enumerateInstanceTargets, pa as DEFAULT_LAYER, pi as ShaderMaterialDefinition, pn as SceneLoadIssue, po as VEC3_UP, pr as LIGHTMAP_MODES, ps as ComponentHandle, pt as PlatformKind, q as TweenTargetValue, qa as SceneFileOverride, qi as ShaderTextureDeclaration, qn as LiteShadowGenerator, qo as CustomFieldCodec, qr as MaterialAsset, qs as ErrorFormatMode, qt as ConcreteComponentType, r as PrefabComponentSkip, ra as LightProbeVolume, rc as THIRD_PARTY_ERROR_PREFIX, ri as standardMaterialDefinition, rn as InstantiateOptions, ro as describeSchema, rr as RENDERING_SETTINGS_SECTION, rs as MapFieldSpec, rt as TWEEN_VALUE_KINDS, s as revertOverrides, sa as LIGHT_PROBE_FORMAT_VERSION, si as LiteShaderMaterial, sn as World, so as VEC3_BACKWARD, sr as TaaSettings, ss as RecordFieldSpec, st as storageInternals, t as PrefabApplyOptions, ta as MATERIAL_ALPHA_MODES, tc as ErrorCode, ti as createMaterialAsset, tn as CreateEntityOptions, to as SchemaDescriptionMeta, tr as DEFAULT_BRDF_LUT_ADDRESS, ts as FieldsOf, tt as EasingName, u as parseOverridePath, ua as createLightProbeAsset, ui as StorageBufferAssetLiteHandles, un as ComponentBuildResult, uo as VEC3_LEFT, ur as REFLECTION_PROBE_REFRESH_MODES, us as VectorFieldSpec, ut as StoredValueKind, v as AppSettings, va as LayerMask, vi as TextureAsset, vn as CameraProjection, vo as Vec2, vr as CapsuleMeshOptions, vs as AssetLoadErrorOptions, vt as LoggerOptions, w as ErrorReport, wa as DecodeResult, wi as ShaderAsset, wn as Mat4, wo as MutableVec2, wr as MeshAssetLiteHandles, ws as AssetState, wt as LogThreshold, x as CoroutineHost, xa as ScriptDefinition, xi as LiteTexture2D, xn as RayVector, xo as ColorLike, xr as MESH_ASSET_TYPE, xs as AssetManifestEntry, xt as LogLevel, y as Coroutine, ya as Script, yi as TextureAssetLiteHandles, yn as PROJECTIONS, yo as QUAT_IDENTITY, yr as CylinderMeshOptions, ys as AssetLoader, yt as createLogger, z as System, za as SCENE_FILE_EXTENSIONS, zi as ShaderBlendMode, zn as RenderTaskTiming, zo as AssetTypeToken, zr as LightmapPlacement, zs as SignalOptions, zt as createFrameSample } from "./prefab-overrides-CkwXhp5A.js";
2
2
  import { AnimationGroup, AssetContainer, DirectionalLight, EngineContext, EnvironmentTextures, Font, HemisphericLight, PointLight, SceneContext, SceneNode, Skeleton, SpotLight, Texture2D } from "@babylonjs/lite";
3
3
  //#region src/settings/settings-input.d.ts
4
4
  /**
@@ -3880,26 +3880,41 @@ interface ContactShadowsEffectSettings {
3880
3880
  }
3881
3881
  /**
3882
3882
  * The `ssgi` record a `PostProcessStack` declares (`docs/architecture/07-rendering.md` §2.7):
3883
- * Lite's `@beta` screen-space global illumination, one bounce of the lit scene colour. Desktop
3884
- * tier.
3883
+ * screen-space global illumination, one bounce of the lit scene colour. Rays traced by Lite find
3884
+ * the light arriving at each pixel from the surfaces on screen; the engine filters it and adds it
3885
+ * times the surface's own diffuse colour, so a red wall lit by a white floor stays red, a white
3886
+ * wall beside it picks up red, and a metal gains nothing. Desktop tier.
3887
+ *
3888
+ * @remarks
3889
+ * The diffuse colour is that of a PBR material. A Standard material counts by its diffuse texture,
3890
+ * or as white without one: its `diffuse` colour does not dim or tint the bounce. An unlit PBR
3891
+ * material receives the bounce like a lit one unless its `metallic` is 1.
3885
3892
  *
3886
3893
  * @beta
3887
3894
  */
3888
3895
  interface SsgiEffectSettings {
3889
3896
  /** Whether the pass runs. */
3890
3897
  enabled: boolean;
3891
- /** How strongly the bounce is added, 0 to 4. */
3898
+ /** How strongly the bounce is added, 0 to 4. At 1 a surface reflects what reaches it. */
3892
3899
  intensity: number;
3893
3900
  /** How far each ray marches, in world units. */
3894
3901
  radius: number;
3895
- /** March steps per ray, 1 to 64. */
3902
+ /** March steps per ray, 1 to 64. More steps find thinner occluders; they do not reduce grain. */
3896
3903
  samples: number;
3897
- /** Whether rays are traced at half resolution. A change rebuilds the pass. */
3904
+ /** Rays traced per pixel, 1 to 8. More rays reduce grain, at a cost that grows with the count. */
3905
+ rays: number;
3906
+ /**
3907
+ * How many edge-aware blur passes smooth the bounce, 0 to 4. Each pass doubles the reach; 0
3908
+ * shows the traced result as it is. A change rebuilds the pass.
3909
+ */
3910
+ denoisePasses: number;
3911
+ /** Whether rays are traced, and the bounce filtered, at half resolution. A change rebuilds the pass. */
3898
3912
  halfResolution: boolean;
3899
3913
  /**
3900
- * How much of the environment's diffuse light remains while SSGI runs, 0 to 1, so the bounce is
3901
- * not counted twice. Needs `rendering.hdr` or the `materialPlugins` feature; without either the
3902
- * environment is left as it is.
3914
+ * How much of the environment's diffuse light remains while SSGI runs, 0 to 1. The default of 1
3915
+ * leaves it whole; lower it when the environment stands in for light SSGI now adds. Needs
3916
+ * `rendering.hdr` or the `materialPlugins` feature; without either the environment is left as it
3917
+ * is.
3903
3918
  */
3904
3919
  environmentDiffuse: number;
3905
3920
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/settings/settings-input.ts","../src/storage/node/file-backend.ts","../src/time/clock.ts","../src/app/app.ts","../src/app/version.ts","../src/assets/asset-ref.ts","../src/assets/assets-service.ts","../src/assets/generic-loaders.ts","../src/assets/manifest.ts","../src/assets/request-queue.ts","../src/errors/error-code-registry.ts","../src/extension/core-extension.ts","../src/extension/define-extension.ts","../src/ids/random-source.ts","../src/ids/ulid.ts","../src/lite/light.ts","../src/log/console-sink.ts","../src/log/memory-sink.ts","../src/math/color.ts","../src/math/math-utils.ts","../src/math/vec4.ts","../src/lite/gpu/environment.ts","../src/render/environment-asset.ts","../src/render/environment.ts","../src/lite/font.ts","../src/render/font-asset.ts","../src/render/light.ts","../src/render/loaders/environment-loader.ts","../src/render/loaders/font-loader.ts","../src/render/loaders/material-loader.ts","../src/render/loaders/mesh-loader.ts","../src/lite/gpu/gltf.ts","../src/render/model-asset.ts","../src/render/loaders/model-loader.ts","../src/render/loaders/texture-loader.ts","../src/render/mesh-file.ts","../src/render/loaders/shader-loader.ts","../src/render/material-plugin.ts","../src/render/surface-shader-compiler.ts","../src/render/post-effect.ts","../src/render/instanced-mesh-renderer.ts","../src/render/model.ts","../src/lite/gpu/bloom-hdr.ts","../src/render/post-process-stack.ts","../src/render/light-probe-bake.ts","../src/render/loaders/light-probe-loader.ts","../src/render/loaders/lightmap-loader.ts","../src/render/schemas.ts","../src/serialization/instance-lookup.ts","../src/serialization/scene-loader.ts","../src/serialization/serialize.ts","../src/serialization/validate.ts","../src/schema/describe-registry.ts","../src/schema/field-kinds.ts","../src/schema/schema.ts","../src/schema/validate.ts","../src/script/wait.ts","../src/settings/describe-settings.ts","../src/storage/memory-backend.ts","../src/storage/names.ts","../src/storage/web/indexeddb-backend.ts","../src/transform/transform-schema.ts","../src/tween/tween-system.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;KAoBY,gBAAgB,SAAS;;;;;;;;UC0E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;;;;;wBAkBI,cACd,QAAQ,QACR,OAAO,SAAS,0BAChB,yBACU;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBCpVI,YAAY,kBAAkB;;;;;;;;;;wBAa9B,oBAAoB,kBAAkB;;;;;;;;;;;;;;;;;;;;;wBAwBtC,mBAAmB;;;;;;;;;;;;;;;wBAkBnB,UAAU,2BAA2B;;;;;;;;;wBAYrC,UAAU,2BAA2B;;;;;;;;;qBC9ExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwJG,iBAAiB,KAAK,MAAM,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqDpD,mBAAmB,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;qBCvMjC,gCAAgC;;;WAElC;;;;;;;;EAYT,IAAU,mBAAmB,cAAc,QAAQ;;;;;;;;;EAanD,IAAU,mBAAmB,aAAa,OAAO,cAAc;;;;;;;;EAgB/D,OAAa,mBAAmB,cAAc;;;;;;;;EAW9C,KAAW,mBAAmB,kBAAkB;;;;;;;EAoBhD,MAAY,oBAAoB;;EAKhC;;;;;;;;;;;;;;;;;;;;;;;;;;;qBC3EW;;;;;;qBAOA;;;;;;;;;;;qBAYA;;;;;;;;;;;;;qBCiHA,mCAAmC;;;WAErC;;;;;;;;EAYT,IAAU,mBAAmB,cAAc,QAAQ;;;;;;;;;EAmBnD,IAAU,mBAAmB,aAAa,OAAO,cAAc;;;;;;;;EAkB/D,OAAa,mBAAmB,cAAc;;;;;;;;EAkB9C,KAAW,mBAAmB,kBAAkB;;;;;;;EA6BhD,MAAY,oBAAoB;;EAYhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBC9Oc,mBAAmB;;;;;;;;;;;;;;;;;;;;qBCVtB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/settings/settings-input.ts","../src/storage/node/file-backend.ts","../src/time/clock.ts","../src/app/app.ts","../src/app/version.ts","../src/assets/asset-ref.ts","../src/assets/assets-service.ts","../src/assets/generic-loaders.ts","../src/assets/manifest.ts","../src/assets/request-queue.ts","../src/errors/error-code-registry.ts","../src/extension/core-extension.ts","../src/extension/define-extension.ts","../src/ids/random-source.ts","../src/ids/ulid.ts","../src/lite/light.ts","../src/log/console-sink.ts","../src/log/memory-sink.ts","../src/math/color.ts","../src/math/math-utils.ts","../src/math/vec4.ts","../src/lite/gpu/environment.ts","../src/render/environment-asset.ts","../src/render/environment.ts","../src/lite/font.ts","../src/render/font-asset.ts","../src/render/light.ts","../src/render/loaders/environment-loader.ts","../src/render/loaders/font-loader.ts","../src/render/loaders/material-loader.ts","../src/render/loaders/mesh-loader.ts","../src/lite/gpu/gltf.ts","../src/render/model-asset.ts","../src/render/loaders/model-loader.ts","../src/render/loaders/texture-loader.ts","../src/render/mesh-file.ts","../src/render/loaders/shader-loader.ts","../src/render/material-plugin.ts","../src/render/surface-shader-compiler.ts","../src/render/post-effect.ts","../src/render/instanced-mesh-renderer.ts","../src/render/model.ts","../src/lite/gpu/bloom-hdr.ts","../src/render/post-process-stack.ts","../src/render/light-probe-bake.ts","../src/render/loaders/light-probe-loader.ts","../src/render/loaders/lightmap-loader.ts","../src/render/schemas.ts","../src/serialization/instance-lookup.ts","../src/serialization/scene-loader.ts","../src/serialization/serialize.ts","../src/serialization/validate.ts","../src/schema/describe-registry.ts","../src/schema/field-kinds.ts","../src/schema/schema.ts","../src/schema/validate.ts","../src/script/wait.ts","../src/settings/describe-settings.ts","../src/storage/memory-backend.ts","../src/storage/names.ts","../src/storage/web/indexeddb-backend.ts","../src/transform/transform-schema.ts","../src/tween/tween-system.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;KAoBY,gBAAgB,SAAS;;;;;;;;UC0EpB;;;;;;WAMN;;;;;;;;;;;;;;;;;;;;;;wBA2TW,yBAAyB,SAAS,qBAAqB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;UCxYpE;;;;;;EAMf;;;;;;;UAQe,oBAAoB;;;;;;;EAO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BAAoB,kBAAkB;;;;;;;;;;;;;;;;;;;;;wBAwBtC,mBAAmB;;;;;;;;;;;;;;;wBAkBnB,UAAU,2BAA2B;;;;;;;;;wBAYrC,UAAU,2BAA2B;;;;;;;;;qBC9ExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwJG,iBAAiB,KAAK,MAAM,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqDpD,mBAAmB,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;qBCvMjC,gCAAgC;;;WAElC;;;;;;;;EAYT,IAAU,mBAAmB,cAAc,QAAQ;;;;;;;;;EAanD,IAAU,mBAAmB,aAAa,OAAO,cAAc;;;;;;;;EAgB/D,OAAa,mBAAmB,cAAc;;;;;;;;EAW9C,KAAW,mBAAmB,kBAAkB;;;;;;;EAoBhD,MAAY,oBAAoB;;EAKhC;;;;;;;;;;;;;;;;;;;;;;;;;;;qBC3EW;;;;;;qBAOA;;;;;;;;;;;qBAYA;;;;;;;;;;;;;qBCiHA,mCAAmC;;;WAErC;;;;;;;;EAYT,IAAU,mBAAmB,cAAc,QAAQ;;;;;;;;;EAmBnD,IAAU,mBAAmB,aAAa,OAAO,cAAc;;;;;;;;EAkB/D,OAAa,mBAAmB,cAAc;;;;;;;;EAkB9C,KAAW,mBAAmB,kBAAkB;;;;;;;EA6BhD,MAAY,oBAAoB;;EAYhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBC9Oc,mBAAmB;;;;;;;;;;;;;;;;;;;;qBCVtB"}
package/dist/index.js CHANGED
@@ -3903,7 +3903,7 @@ function createServiceKey(name) {
3903
3903
  *
3904
3904
  * @public
3905
3905
  */
3906
- const VERSION = "0.21.1";
3906
+ const VERSION = "0.22.0";
3907
3907
  //#endregion
3908
3908
  //#region src/assets/delivery-system.ts
3909
3909
  /**
@@ -10312,20 +10312,23 @@ var RendererImpl = class {
10312
10312
  * The first call loads the `scene-inputs` chunk and adds the pass to the frame graph; the last
10313
10313
  * `release()` removes it. Nothing is loaded or added until an effect calls this.
10314
10314
  *
10315
+ * @param options - What the user needs beyond depth, normals, velocity and the depth pyramid.
10315
10316
  * @returns The lease, or `null` under the null engine or once the renderer is disposed.
10316
10317
  *
10317
10318
  * @internal
10318
10319
  */
10319
- async acquireSceneInputs() {
10320
+ async acquireSceneInputs(options) {
10320
10321
  if (this.isHeadless || this.#isDisposed) return null;
10321
10322
  const { engine, scene } = this;
10322
- this.#sceneInputs ??= import("./scene-inputs-_0j2Hi6L.js").then((module) => {
10323
- const host = module.createSceneInputsHost(engine, scene);
10323
+ this.#sceneInputs ??= import("./scene-inputs-CbTkrkOw.js").then((module) => {
10324
+ const host = module.createSceneInputsHost(engine, scene, (message) => {
10325
+ this.#app.log.error(message);
10326
+ });
10324
10327
  this.#sceneInputsHost = host;
10325
10328
  if (this.#isDisposed) host.dispose();
10326
10329
  return host;
10327
10330
  });
10328
- return (await this.#sceneInputs).acquire(this.#isSceneRegistered);
10331
+ return (await this.#sceneInputs).acquire(this.#isSceneRegistered, options);
10329
10332
  }
10330
10333
  /**
10331
10334
  * Installs temporal anti-aliasing when `rendering.taa.enabled` is on.
@@ -10966,7 +10969,7 @@ var RendererImpl = class {
10966
10969
  */
10967
10970
  async #installAmbientOcclusion() {
10968
10971
  const settings = resolveAmbientOcclusion(this.settings.ambientOcclusion);
10969
- const [module, inputs] = await Promise.all([import("./gtao-BmdrXXJz.js"), this.acquireSceneInputs()]);
10972
+ const [module, inputs] = await Promise.all([import("./gtao-CVAYWBEJ.js"), this.acquireSceneInputs()]);
10970
10973
  if (inputs === null) return;
10971
10974
  if (this.#isDisposed) {
10972
10975
  inputs.release();
@@ -18146,7 +18149,7 @@ var ScreenSpaceEffects = class {
18146
18149
  const tier = renderer.qualityPreset;
18147
18150
  const runsContact = contact.enabled && (tier === null || tier.contactShadows);
18148
18151
  const runsSsgi = ssgi.enabled && (tier === null || tier.ssgi);
18149
- const key = buildKey(renderer, runsContact, runsSsgi, ssgi.halfResolution, isEnabled);
18152
+ const key = buildKey(renderer, runsContact, runsSsgi ? ssgi : null, isEnabled);
18150
18153
  if (key !== this.#key) {
18151
18154
  this.#key = key;
18152
18155
  this.#teardown(renderer.isSceneRegistered);
@@ -18179,8 +18182,8 @@ var ScreenSpaceEffects = class {
18179
18182
  const built = this.#built;
18180
18183
  this.#built = null;
18181
18184
  if (built === null) return;
18182
- built.ssgi?.dispose(isSceneRegistered);
18183
18185
  built.installed.dispose();
18186
+ built.ssgi?.dispose(isSceneRegistered);
18184
18187
  built.inputs.release();
18185
18188
  }
18186
18189
  /**
@@ -18193,10 +18196,10 @@ var ScreenSpaceEffects = class {
18193
18196
  */
18194
18197
  async #build(renderer, contact, ssgi, generation) {
18195
18198
  const [inputs, wiring, contactModule, ssgiModule] = await Promise.all([
18196
- renderer.acquireSceneInputs(),
18197
- import("./scene-color-passes-DgXJ45Ql.js"),
18199
+ renderer.acquireSceneInputs({ albedo: ssgi !== null }),
18200
+ import("./scene-color-passes-CM_T2KF-.js"),
18198
18201
  contact === null ? null : import("./contact-shadows-T523EXaP.js"),
18199
- ssgi === null ? null : import("./ssgi-DSnhqotl.js")
18202
+ ssgi === null ? null : import("./ssgi-Dk20U3oR.js")
18200
18203
  ]);
18201
18204
  const presenter = renderer.presenter;
18202
18205
  const camera = renderer.isHeadless ? null : renderer.scene.camera;
@@ -18208,13 +18211,22 @@ var ScreenSpaceEffects = class {
18208
18211
  const passes = [];
18209
18212
  const contactPass = contact === null ? null : contactModule?.createContactShadowsPass(engine, scene, inputs.depthTarget, camera, contact) ?? null;
18210
18213
  if (contactPass !== null) passes.push(contactPass);
18211
- const ssgiPass = ssgi === null ? null : ssgiModule?.createSsgiPass(engine, scene, inputs.depthTarget, camera, {
18214
+ const ssgiPass = ssgi === null ? null : ssgiModule?.createSsgiPass(engine, scene, inputs, camera, {
18212
18215
  tuning: ssgi,
18213
18216
  halfResolution: ssgi.halfResolution,
18217
+ denoisePasses: ssgi.denoisePasses,
18218
+ isLinear: presenter.hdr !== null,
18214
18219
  usePlugin: renderer.settings.hdr || renderer.features.materialPlugins
18215
18220
  }) ?? null;
18216
18221
  if (ssgiPass !== null) passes.push(ssgiPass);
18217
- const installed = wiring.installSceneColorPasses(engine, scene, presenter, passes, renderer.isSceneRegistered);
18222
+ let installed;
18223
+ try {
18224
+ installed = wiring.installSceneColorPasses(engine, scene, presenter, passes, renderer.isSceneRegistered);
18225
+ } catch (failure) {
18226
+ ssgiPass?.dispose(renderer.isSceneRegistered);
18227
+ inputs.release();
18228
+ throw failure;
18229
+ }
18218
18230
  this.#built = {
18219
18231
  inputs,
18220
18232
  installed,
@@ -18226,17 +18238,17 @@ var ScreenSpaceEffects = class {
18226
18238
  }
18227
18239
  };
18228
18240
  /**
18229
- * The build's identity: which passes run, SSGI's resolution, and the camera; `""` for none.
18241
+ * The build's identity: which passes run, SSGI's resolution and denoise pass count, and the camera;
18242
+ * `""` for none.
18230
18243
  *
18231
18244
  * @param renderer - The rendering service.
18232
18245
  * @param runsContact - Whether contact shadows run.
18233
- * @param runsSsgi - Whether SSGI runs.
18234
- * @param ssgiHalf - SSGI's `halfResolution`.
18246
+ * @param ssgi - The `ssgi` record when SSGI runs, else `null`.
18235
18247
  * @param isEnabled - Whether the stack is enabled in the hierarchy.
18236
18248
  * @returns The key.
18237
18249
  */
18238
- function buildKey(renderer, runsContact, runsSsgi, ssgiHalf, isEnabled) {
18239
- if (!isEnabled || !runsContact && !runsSsgi || renderer.isHeadless || renderer.presenter === null) return "";
18250
+ function buildKey(renderer, runsContact, ssgi, isEnabled) {
18251
+ if (!isEnabled || !runsContact && ssgi === null || renderer.isHeadless || renderer.presenter === null) return "";
18240
18252
  const camera = renderer.scene.camera;
18241
18253
  if (camera === null) return "";
18242
18254
  cameraIds ??= /* @__PURE__ */ new WeakMap();
@@ -18246,7 +18258,8 @@ function buildKey(renderer, runsContact, runsSsgi, ssgiHalf, isEnabled) {
18246
18258
  nextCameraId += 1;
18247
18259
  cameraIds.set(camera, id);
18248
18260
  }
18249
- return `${runsContact ? "contact" : ""}|${runsSsgi ? `ssgi:${ssgiHalf ? "half" : "full"}` : ""}|camera:${String(id)}`;
18261
+ const gi = ssgi === null ? "" : `ssgi:${ssgi.halfResolution ? "half" : "full"}:${String(ssgi.denoisePasses)}`;
18262
+ return `${runsContact ? "contact" : ""}|${gi}|camera:${String(id)}`;
18250
18263
  }
18251
18264
  //#endregion
18252
18265
  //#region src/render/post-process-stack.ts
@@ -18769,7 +18782,7 @@ function postProcessSchema() {
18769
18782
  intensity: f32(1, {
18770
18783
  min: 0,
18771
18784
  max: 4,
18772
- tooltip: "How strongly the bounced light is added."
18785
+ tooltip: "How strongly the bounced light is added. At 1 a surface reflects what reaches it."
18773
18786
  }),
18774
18787
  radius: f32(2, {
18775
18788
  min: .001,
@@ -18778,15 +18791,25 @@ function postProcessSchema() {
18778
18791
  samples: u32(8, {
18779
18792
  min: 1,
18780
18793
  max: 64,
18781
- tooltip: "March steps per ray."
18794
+ tooltip: "March steps per ray. More steps do not reduce grain."
18795
+ }),
18796
+ rays: u32(2, {
18797
+ min: 1,
18798
+ max: 8,
18799
+ tooltip: "Rays traced per pixel. More rays reduce grain and cost more."
18800
+ }),
18801
+ denoisePasses: u32(4, {
18802
+ min: 0,
18803
+ max: 4,
18804
+ tooltip: "Edge-aware blur passes over the bounce; each doubles the reach. A change rebuilds the pass."
18782
18805
  }),
18783
- halfResolution: bool(true, { tooltip: "Trace at half resolution. A change rebuilds the pass." }),
18784
- environmentDiffuse: f32(.5, {
18806
+ halfResolution: bool(true, { tooltip: "Trace and filter at half resolution. A change rebuilds the pass." }),
18807
+ environmentDiffuse: f32(1, {
18785
18808
  min: 0,
18786
18809
  max: 1,
18787
- tooltip: "How much of the environment's diffuse light remains while SSGI runs, so the bounce is not counted twice. Needs rendering.hdr or the materialPlugins feature."
18810
+ tooltip: "How much of the environment's diffuse light remains while SSGI runs. Needs rendering.hdr or the materialPlugins feature."
18788
18811
  })
18789
- }, { tooltip: "One bounce of the lit scene colour (beta, desktop tier). Runs on the scene colour before the chain; needs rendering.features.postProcessing." })
18812
+ }, { tooltip: "One bounce of the lit scene colour, reflected in each surface's own colour (beta, desktop tier). Runs on the scene colour before the chain; needs rendering.features.postProcessing." })
18790
18813
  });
18791
18814
  }
18792
18815
  //#endregion