1 |
- {"ast":null,"code":"import { EngineStore } from \"../../Engines/engineStore.js\";\nimport { Matrix, Vector3, Vector4, Quaternion } from \"../../Maths/math.vector.js\";\nimport { Texture } from \"../../Materials/Textures/texture.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { _IblShadowsVoxelRenderer } from \"./iblShadowsVoxelRenderer.js\";\nimport { _IblShadowsVoxelTracingPass } from \"./iblShadowsVoxelTracingPass.js\";\nimport { PostProcess } from \"../../PostProcesses/postProcess.js\";\nimport { _IblShadowsImportanceSamplingRenderer } from \"./iblShadowsImportanceSamplingRenderer.js\";\nimport { _IblShadowsSpatialBlurPass } from \"./iblShadowsSpatialBlurPass.js\";\nimport { _IblShadowsAccumulationPass } from \"./iblShadowsAccumulationPass.js\";\nimport { PostProcessRenderPipeline } from \"../../PostProcesses/RenderPipeline/postProcessRenderPipeline.js\";\nimport { PostProcessRenderEffect } from \"../../PostProcesses/RenderPipeline/postProcessRenderEffect.js\";\nimport { GeometryBufferRenderer } from \"../geometryBufferRenderer.js\";\nimport { RawTexture } from \"../../Materials/Textures/rawTexture.js\";\nimport { RawTexture3D } from \"../../Materials/Textures/rawTexture3D.js\";\nimport { Engine } from \"../../Engines/engine.js\";\nimport { IBLShadowsPluginMaterial } from \"./iblShadowsPluginMaterial.js\";\nimport { PBRBaseMaterial } from \"../../Materials/PBR/pbrBaseMaterial.js\";\nimport { StandardMaterial } from \"../../Materials/standardMaterial.js\";\nimport { Observable } from \"../../Misc/observable.js\";\n/**\n * Voxel-based shadow rendering for IBL's.\n * This should not be instanciated directly, as it is part of a scene component\n */\nexport class IblShadowsRenderPipeline extends PostProcessRenderPipeline {\n /**\n * Reset the shadow accumulation. This has a similar affect to lowering the remanence for a single frame.\n * This is useful when making a sudden change to the IBL.\n */\n resetAccumulation() {\n this._accumulationPass.reset = true;\n }\n /**\n * How dark the shadows appear. 1.0 is full opacity, 0.0 is no shadows.\n */\n get shadowOpacity() {\n return this._shadowOpacity;\n }\n set shadowOpacity(value) {\n this._shadowOpacity = value;\n this._setPluginParameters();\n }\n /**\n * A multiplier for the render size of the shadows. Used for rendering lower-resolution shadows.\n */\n get shadowRenderSizeFactor() {\n return this._renderSizeFactor;\n }\n set shadowRenderSizeFactor(value) {\n this._renderSizeFactor = Math.max(Math.min(value, 1.0), 0.0);\n this._voxelTracingPass.resize(value);\n this._spatialBlurPass.resize(value);\n this._accumulationPass.resize(value);\n this._setPluginParameters();\n }\n /**\n * How dark the voxel shadows appear. 1.0 is full opacity, 0.0 is no shadows.\n */\n get voxelShadowOpacity() {\n var _this$_voxelTracingPa;\n return (_this$_voxelTracingPa = this._voxelTracingPass) === null || _this$_voxelTracingPa === void 0 ? void 0 : _this$_voxelTracingPa.voxelShadowOpacity;\n }\n set voxelShadowOpacity(value) {\n if (!this._voxelTracingPass) return;\n this._voxelTracingPass.voxelShadowOpacity = value;\n }\n /**\n * How dark the screen-space shadows appear. 1.0 is full opacity, 0.0 is no shadows.\n */\n get ssShadowOpacity() {\n var _this$_voxelTracingPa2;\n return (_this$_voxelTracingPa2 = this._voxelTracingPass) === null || _this$_voxelTracingPa2 === void 0 ? void 0 : _this$_voxelTracingPa2.ssShadowOpacity;\n }\n set ssShadowOpacity(value) {\n if (!this._voxelTracingPass) return;\n this._voxelTracingPass.ssShadowOpacity = value;\n }\n /**\n * The number of samples used in the screen space shadow pass.\n */\n get ssShadowSampleCount() {\n var _this$_voxelTracingPa3;\n return (_this$_voxelTracingPa3 = this._voxelTracingPass) === null || _this$_voxelTracingPa3 === void 0 ? void 0 : _this$_voxelTracingPa3.sssSamples;\n }\n set ssShadowSampleCount(value) {\n if (!this._voxelTracingPass) return;\n this._voxelTracingPass.sssSamples = value;\n }\n /**\n * The stride of the screen-space shadow pass. This controls the distance between samples\n * in pixels.\n */\n get ssShadowStride() {\n var _this$_voxelTracingPa4;\n return (_this$_voxelTracingPa4 = this._voxelTracingPass) === null || _this$_voxelTracingPa4 === void 0 ? void 0 : _this$_voxelTracingPa4.sssStride;\n }\n set ssShadowStride(value) {\n if (!this._voxelTracingPass) return;\n this._voxelTracingPass.sssStride = value;\n }\n /**\n * A scale for the maximum distance a screen-space shadow can be cast in world-space.\n * The maximum distance that screen-space shadows cast is derived from the voxel size\n * and this value so shouldn't need to change if you scale your scene\n */\n get ssShadowDistanceScale() {\n return this._sssMaxDistScale;\n }\n set ssShadowDistanceScale(value) {\n this._sssMaxDistScale = value;\n this._updateSSShadowParams();\n }\n /**\n * Screen-space shadow thickness scale. This value controls the assumed thickness of\n * on-screen surfaces in world-space. It scales with the size of the shadow-casting\n * region so shouldn't need to change if you scale your scene.\n */\n get ssShadowThicknessScale() {\n return this._sssThicknessScale;\n }\n set ssShadowThicknessScale(value) {\n this._sssThicknessScale = value;\n this._updateSSShadowParams();\n }\n /**\n * Set the IBL image to be used for shadowing. It can be either a cubemap\n * or a 2D equirectangular texture.\n * @param iblSource The texture to use for IBL shadowing\n */\n setIblTexture(iblSource) {\n if (!this._importanceSamplingRenderer) return;\n this._importanceSamplingRenderer.iblSource = iblSource;\n }\n /**\n * Returns the texture containing the voxel grid data\n * @returns The texture containing the voxel grid data\n * @internal\n */\n _getVoxelGridTexture() {\n var _this$_voxelRenderer;\n const tex = (_this$_voxelRenderer = this._voxelRenderer) === null || _this$_voxelRenderer === void 0 ? void 0 : _this$_voxelRenderer.getVoxelGrid();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture3d;\n }\n /**\n * Returns the texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @returns The texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @internal\n */\n _getIcdfyTexture() {\n const tex = this._importanceSamplingRenderer.getIcdfyTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @returns The texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @internal\n */\n _getIcdfxTexture() {\n const tex = this._importanceSamplingRenderer.getIcdfxTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the noise texture.\n * @returns The noise texture.\n * @internal\n */\n _getNoiseTexture() {\n const tex = this._noiseTexture;\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the voxel-tracing texture.\n * @returns The voxel-tracing texture.\n * @internal\n */\n _getVoxelTracingTexture() {\n var _this$_voxelTracingPa5;\n const tex = (_this$_voxelTracingPa5 = this._voxelTracingPass) === null || _this$_voxelTracingPa5 === void 0 ? void 0 : _this$_voxelTracingPa5.getOutputTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the spatial blur texture.\n * @returns The spatial blur texture.\n * @internal\n */\n _getSpatialBlurTexture() {\n const tex = this._spatialBlurPass.getOutputTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the accumulated shadow texture.\n * @returns The accumulated shadow texture.\n * @internal\n */\n _getAccumulatedTexture() {\n var _this$_accumulationPa;\n const tex = (_this$_accumulationPa = this._accumulationPass) === null || _this$_accumulationPa === void 0 ? void 0 : _this$_accumulationPa.getOutputTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Turn on or off the debug view of the G-Buffer. This will display only the targets\n * of the g-buffer that are used by the shadow pipeline.\n */\n get gbufferDebugEnabled() {\n return this._gbufferDebugEnabled;\n }\n set gbufferDebugEnabled(enabled) {\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable G-Buffer debug view without setting allowDebugPasses to true.\");\n return;\n }\n this._gbufferDebugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._getGBufferDebugPass().name, this.cameras);\n } else {\n this._disableEffect(this._getGBufferDebugPass().name, this.cameras);\n }\n }\n /**\n * Turn on or off the debug view of the CDF importance sampling data\n */\n get importanceSamplingDebugEnabled() {\n var _this$_importanceSamp;\n return (_this$_importanceSamp = this._importanceSamplingRenderer) === null || _this$_importanceSamp === void 0 ? void 0 : _this$_importanceSamp.debugEnabled;\n }\n /**\n * Turn on or off the debug view of the CDF importance sampling data\n */\n set importanceSamplingDebugEnabled(enabled) {\n if (!this._importanceSamplingRenderer) return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable importance sampling debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._importanceSamplingRenderer.debugEnabled) return;\n this._importanceSamplingRenderer.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._importanceSamplingRenderer.debugPassName, this.cameras);\n } else {\n this._disableEffect(this._importanceSamplingRenderer.debugPassName, this.cameras);\n }\n }\n /**\n * This displays the voxel grid in slices spread across the screen.\n * It also displays what slices of the model are stored in each layer\n * of the voxel grid. Each red stripe represents one layer while each gradient\n * (from bright red to black) represents the layers rendered in a single draw call.\n */\n get voxelDebugEnabled() {\n var _this$_voxelRenderer2;\n return (_this$_voxelRenderer2 = this._voxelRenderer) === null || _this$_voxelRenderer2 === void 0 ? void 0 : _this$_voxelRenderer2.voxelDebugEnabled;\n }\n set voxelDebugEnabled(enabled) {\n if (!this._voxelRenderer) return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable voxel debug view without setting allowDebugPasses to true.\");\n return;\n }\n this._voxelRenderer.voxelDebugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._voxelRenderer.debugPassName, this.cameras);\n } else {\n this._disableEffect(this._voxelRenderer.debugPassName, this.cameras);\n }\n }\n /**\n * When using tri-planar voxelization (the default), this value can be used to\n * display only the voxelization result for that axis. z-axis = 0, y-axis = 1, x-axis = 2\n */\n get voxelDebugAxis() {\n var _this$_voxelRenderer3;\n return (_this$_voxelRenderer3 = this._voxelRenderer) === null || _this$_voxelRenderer3 === void 0 ? void 0 : _this$_voxelRenderer3.voxelDebugAxis;\n }\n set voxelDebugAxis(axisNum) {\n if (!this._voxelRenderer) return;\n this._voxelRenderer.voxelDebugAxis = axisNum;\n }\n /**\n * Displays a given mip of the voxel grid. `voxelDebugAxis` must be undefined in this\n * case because we only generate mips for the combined voxel grid.\n */\n set voxelDebugDisplayMip(mipNum) {\n if (!this._voxelRenderer) return;\n this._voxelRenderer.setDebugMipNumber(mipNum);\n }\n /**\n * Display the debug view for just the shadow samples taken this frame.\n */\n get voxelTracingDebugEnabled() {\n var _this$_voxelTracingPa6;\n return (_this$_voxelTracingPa6 = this._voxelTracingPass) === null || _this$_voxelTracingPa6 === void 0 ? void 0 : _this$_voxelTracingPa6.debugEnabled;\n }\n set voxelTracingDebugEnabled(enabled) {\n if (!this._voxelTracingPass) return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable voxel tracing debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._voxelTracingPass.debugEnabled) return;\n this._voxelTracingPass.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._voxelTracingPass.debugPassName, this.cameras);\n } else {\n this._disableEffect(this._voxelTracingPass.debugPassName, this.cameras);\n }\n }\n /**\n * Display the debug view for the spatial blur pass\n */\n get spatialBlurPassDebugEnabled() {\n return this._spatialBlurPass.debugEnabled;\n }\n set spatialBlurPassDebugEnabled(enabled) {\n if (!this._spatialBlurPass) return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable spatial blur debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._spatialBlurPass.debugEnabled) return;\n this._spatialBlurPass.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._spatialBlurPass.debugPassName, this.cameras);\n } else {\n this._disableEffect(this._spatialBlurPass.debugPassName, this.cameras);\n }\n }\n /**\n * Display the debug view for the shadows accumulated over time.\n */\n get accumulationPassDebugEnabled() {\n var _this$_accumulationPa2;\n return (_this$_accumulationPa2 = this._accumulationPass) === null || _this$_accumulationPa2 === void 0 ? void 0 : _this$_accumulationPa2.debugEnabled;\n }\n set accumulationPassDebugEnabled(enabled) {\n if (!this._accumulationPass) return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable accumulation pass debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._accumulationPass.debugEnabled) return;\n this._accumulationPass.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._accumulationPass.debugPassName, this.cameras);\n } else {\n this._disableEffect(this._accumulationPass.debugPassName, this.cameras);\n }\n }\n /**\n * Add a mesh to be used for shadow-casting in the IBL shadow pipeline.\n * These meshes will be written to the voxel grid.\n * @param mesh A mesh or list of meshes that you want to cast shadows\n */\n addShadowCastingMesh(mesh) {\n if (Array.isArray(mesh)) {\n for (const m of mesh) {\n if (m && this._shadowCastingMeshes.indexOf(m) === -1) {\n this._shadowCastingMeshes.push(m);\n }\n }\n } else {\n if (mesh && this._shadowCastingMeshes.indexOf(mesh) === -1) {\n this._shadowCastingMeshes.push(mesh);\n }\n }\n }\n /**\n * Remove a mesh from the shadow-casting list. The mesh will no longer be written\n * to the voxel grid and will not cast shadows.\n * @param mesh The mesh or list of meshes that you don't want to cast shadows.\n */\n removeShadowCastingMesh(mesh) {\n if (Array.isArray(mesh)) {\n for (const m of mesh) {\n const index = this._shadowCastingMeshes.indexOf(m);\n if (index !== -1) {\n this._shadowCastingMeshes.splice(index, 1);\n }\n }\n } else {\n const index = this._shadowCastingMeshes.indexOf(mesh);\n if (index !== -1) {\n this._shadowCastingMeshes.splice(index, 1);\n }\n }\n }\n /**\n * The exponent of the resolution of the voxel shadow grid. Higher resolutions will result in sharper\n * shadows but are more expensive to compute and require more memory.\n * The resolution is calculated as 2 to the power of this number.\n */\n get resolutionExp() {\n return this._voxelRenderer.voxelResolutionExp;\n }\n set resolutionExp(newResolution) {\n if (newResolution === this._voxelRenderer.voxelResolutionExp) return;\n if (this._voxelRenderer.isVoxelizationInProgress()) {\n Logger.Warn(\"Can't change the resolution of the voxel grid while voxelization is in progress.\");\n return;\n }\n this._voxelRenderer.voxelResolutionExp = Math.max(1, Math.min(newResolution, 8));\n this._accumulationPass.reset = true;\n }\n /**\n * The number of different directions to sample during the voxel tracing pass\n */\n get sampleDirections() {\n var _this$_voxelTracingPa7;\n return (_this$_voxelTracingPa7 = this._voxelTracingPass) === null || _this$_voxelTracingPa7 === void 0 ? void 0 : _this$_voxelTracingPa7.sampleDirections;\n }\n /**\n * The number of different directions to sample during the voxel tracing pass\n */\n set sampleDirections(value) {\n if (!this._voxelTracingPass) return;\n this._voxelTracingPass.sampleDirections = value;\n }\n /**\n * The decree to which the shadows persist between frames. 0.0 is no persistence, 1.0 is full persistence.\n **/\n get shadowRemanence() {\n var _this$_accumulationPa3;\n return (_this$_accumulationPa3 = this._accumulationPass) === null || _this$_accumulationPa3 === void 0 ? void 0 : _this$_accumulationPa3.remanence;\n }\n /**\n * The decree to which the shadows persist between frames. 0.0 is no persistence, 1.0 is full persistence.\n **/\n set shadowRemanence(value) {\n if (!this._accumulationPass) return;\n this._accumulationPass.remanence = value;\n }\n /**\n * The global Y-axis rotation of the IBL for shadows. This should match the Y-rotation of the environment map applied to materials, skybox, etc.\n */\n get envRotation() {\n var _this$_voxelTracingPa8;\n return (_this$_voxelTracingPa8 = this._voxelTracingPass) === null || _this$_voxelTracingPa8 === void 0 ? void 0 : _this$_voxelTracingPa8.envRotation;\n }\n /**\n * The global Y-axis rotation of the IBL for shadows. This should match the Y-rotation of the environment map applied to materials, skybox, etc.\n */\n set envRotation(value) {\n if (!this._voxelTracingPass) return;\n this._voxelTracingPass.envRotation = value;\n this._accumulationPass.reset = true;\n }\n /**\n * Allow debug passes to be enabled. Default is false.\n */\n get allowDebugPasses() {\n return this._allowDebugPasses;\n }\n /**\n * Allow debug passes to be enabled. Default is false.\n */\n set allowDebugPasses(value) {\n if (this._allowDebugPasses === value) return;\n this._allowDebugPasses = value;\n if (value) {\n if (this._importanceSamplingRenderer.isReady()) {\n this._createDebugPasses();\n } else {\n this._importanceSamplingRenderer.onReadyObservable.addOnce(() => {\n this._createDebugPasses();\n });\n }\n } else {\n this._disposeDebugPasses();\n }\n }\n /**\n * Support test.\n */\n static get IsSupported() {\n const engine = EngineStore.LastCreatedEngine;\n if (!engine) {\n return false;\n }\n return engine._features.supportIBLShadows;\n }\n /**\n * Toggle the shadow tracing on or off\n * @param enabled Toggle the shadow tracing on or off\n */\n toggleShadow(enabled) {\n this._enabled = enabled;\n this._voxelTracingPass.enabled = enabled;\n this._spatialBlurPass.enabled = enabled;\n this._accumulationPass.enabled = enabled;\n this._materialsWithRenderPlugin.forEach(mat => {\n if (mat.pluginManager) {\n const plugin = mat.pluginManager.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.isEnabled = enabled;\n }\n });\n this._setPluginParameters();\n }\n /**\n * Trigger the scene to be re-voxelized. This should be run when any shadow-casters have been added, removed or moved.\n */\n updateVoxelization() {\n if (this._shadowCastingMeshes.length === 0) {\n Logger.Warn(\"IBL Shadows: updateVoxelization called with no shadow-casting meshes to voxelize.\");\n return;\n }\n this._voxelRenderer.updateVoxelGrid(this._shadowCastingMeshes);\n this._updateSSShadowParams();\n }\n /**\n * Trigger the scene bounds of shadow-casters to be calculated. This is the world size that the voxel grid will cover and will always be a cube.\n */\n updateSceneBounds() {\n const bounds = {\n min: new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE),\n max: new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE)\n };\n this._shadowCastingMeshes.forEach(mesh => {\n const localBounds = mesh.getHierarchyBoundingVectors(true);\n bounds.min = Vector3.Minimize(bounds.min, localBounds.min);\n bounds.max = Vector3.Maximize(bounds.max, localBounds.max);\n });\n const size = bounds.max.subtract(bounds.min);\n this.voxelGridSize = Math.max(size.x, size.y, size.z);\n if (this._shadowCastingMeshes.length === 0 || !isFinite(this.voxelGridSize) || this.voxelGridSize === 0) {\n Logger.Warn(\"IBL Shadows: Scene size is invalid. Can't update bounds.\");\n this.voxelGridSize = 1.0;\n return;\n }\n const halfSize = this.voxelGridSize / 2.0;\n const centre = bounds.max.add(bounds.min).multiplyByFloats(-0.5, -0.5, -0.5);\n const invWorldScaleMatrix = Matrix.Compose(new Vector3(1.0 / halfSize, 1.0 / halfSize, 1.0 / halfSize), new Quaternion(), new Vector3(0, 0, 0));\n const invTranslationMatrix = Matrix.Compose(new Vector3(1.0, 1.0, 1.0), new Quaternion(), centre);\n invTranslationMatrix.multiplyToRef(invWorldScaleMatrix, invWorldScaleMatrix);\n this._voxelTracingPass.setWorldScaleMatrix(invWorldScaleMatrix);\n this._voxelRenderer.setWorldScaleMatrix(invWorldScaleMatrix);\n // Set world scale for spatial blur.\n this._spatialBlurPass.setWorldScale(halfSize * 2.0);\n this._updateSSShadowParams();\n }\n /**\n * @param name The rendering pipeline name\n * @param scene The scene linked to this pipeline\n * @param options Options to configure the pipeline\n * @param cameras Cameras to apply the pipeline to.\n */\n constructor(name, scene, options = {}, cameras) {\n var _options$voxelShadowO, _options$envRotation, _options$shadowRemane;\n super(scene.getEngine(), name);\n this._allowDebugPasses = false;\n this._debugPasses = [];\n this._shadowCastingMeshes = [];\n this._shadowOpacity = 0.8;\n this._enabled = true;\n this._materialsWithRenderPlugin = [];\n /**\n * Observable that triggers when the shadow renderer is ready\n */\n this.onShadowTextureReadyObservable = new Observable();\n /**\n * Observable that triggers when a new IBL is set and the importance sampling is ready\n */\n this.onNewIblReadyObservable = new Observable();\n /**\n * The current world-space size of that the voxel grid covers in the scene.\n */\n this.voxelGridSize = 1.0;\n this._renderSizeFactor = 1.0;\n this._gbufferDebugEnabled = false;\n this._gBufferDebugSizeParams = new Vector4(0.0, 0.0, 0.0, 0.0);\n this.scene = scene;\n this._cameras = cameras || [scene.activeCamera];\n // Create the dummy textures to be used when the pipeline is not ready\n const blackPixels = new Uint8Array([0, 0, 0, 255]);\n this._dummyTexture2d = new RawTexture(blackPixels, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false);\n this._dummyTexture3d = new RawTexture3D(blackPixels, 1, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false);\n // Setup the geometry buffer target formats\n const textureTypesAndFormats = {};\n textureTypesAndFormats[GeometryBufferRenderer.SCREENSPACE_DEPTH_TEXTURE_TYPE] = {\n textureFormat: 6,\n textureType: 1\n };\n textureTypesAndFormats[GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE] = {\n textureFormat: 7,\n textureType: 2\n };\n textureTypesAndFormats[GeometryBufferRenderer.POSITION_TEXTURE_TYPE] = {\n textureFormat: 5,\n textureType: 2\n };\n textureTypesAndFormats[GeometryBufferRenderer.NORMAL_TEXTURE_TYPE] = {\n textureFormat: 5,\n textureType: 2\n };\n const geometryBufferRenderer = scene.enableGeometryBufferRenderer(undefined, 14, textureTypesAndFormats);\n if (!geometryBufferRenderer) {\n Logger.Error(\"Geometry buffer renderer is required for IBL shadows to work.\");\n return;\n }\n this._geometryBufferRenderer = geometryBufferRenderer;\n this._geometryBufferRenderer.enableScreenspaceDepth = true;\n this._geometryBufferRenderer.enableVelocityLinear = true;\n this._geometryBufferRenderer.enablePosition = true;\n this._geometryBufferRenderer.enableNormal = true;\n this._geometryBufferRenderer.generateNormalsInWorldSpace = true;\n this.shadowOpacity = options.shadowOpacity || 0.8;\n this._voxelRenderer = new _IblShadowsVoxelRenderer(this.scene, this, options ? options.resolutionExp : 6, options.triPlanarVoxelization !== undefined ? options.triPlanarVoxelization : true);\n this._importanceSamplingRenderer = new _IblShadowsImportanceSamplingRenderer(this.scene);\n this._voxelTracingPass = new _IblShadowsVoxelTracingPass(this.scene, this);\n this._spatialBlurPass = new _IblShadowsSpatialBlurPass(this.scene, this);\n this._accumulationPass = new _IblShadowsAccumulationPass(this.scene, this);\n this._accumulationPass.onReadyObservable.addOnce(() => {\n this.onShadowTextureReadyObservable.notifyObservers();\n });\n this.sampleDirections = options.sampleDirections || 2;\n this.voxelShadowOpacity = (_options$voxelShadowO = options.voxelShadowOpacity) !== null && _options$voxelShadowO !== void 0 ? _options$voxelShadowO : 1.0;\n this.envRotation = (_options$envRotation = options.envRotation) !== null && _options$envRotation !== void 0 ? _options$envRotation : 0.0;\n this.shadowRenderSizeFactor = options.shadowRenderSizeFactor || 1.0;\n this.ssShadowOpacity = options.ssShadowsEnabled === undefined || options.ssShadowsEnabled ? 1.0 : 0.0;\n this.ssShadowDistanceScale = options.ssShadowDistanceScale || 1.25;\n this.ssShadowSampleCount = options.ssShadowSampleCount || 16;\n this.ssShadowStride = options.ssShadowStride || 8;\n this.ssShadowThicknessScale = options.ssShadowThicknessScale || 1.0;\n this.shadowRemanence = (_options$shadowRemane = options.shadowRemanence) !== null && _options$shadowRemane !== void 0 ? _options$shadowRemane : 0.75;\n this._noiseTexture = new Texture(\"https://assets.babylonjs.com/textures/blue_noise/blue_noise_rgb.png\", this.scene, false, true, 1);\n if (this.scene.environmentTexture) {\n this._importanceSamplingRenderer.iblSource = this.scene.environmentTexture;\n }\n scene.postProcessRenderPipelineManager.addPipeline(this);\n this.scene.onActiveCameraChanged.add(this._listenForCameraChanges.bind(this));\n this.scene.onBeforeRenderObservable.add(this._updateBeforeRender.bind(this));\n this._listenForCameraChanges();\n this.scene.getEngine().onResizeObservable.add(this._handleResize.bind(this));\n // Assigning the shadow texture to the materials needs to be done after the RT's are created.\n this._importanceSamplingRenderer.onReadyObservable.add(() => {\n this._setPluginParameters();\n this.onNewIblReadyObservable.notifyObservers();\n });\n }\n _handleResize() {\n this._voxelRenderer.resize();\n this._voxelTracingPass.resize(this.shadowRenderSizeFactor);\n this._spatialBlurPass.resize(this.shadowRenderSizeFactor);\n this._accumulationPass.resize(this.shadowRenderSizeFactor);\n this._setPluginParameters();\n }\n _getGBufferDebugPass() {\n if (this._gbufferDebugPass) {\n return this._gbufferDebugPass;\n }\n const isWebGPU = this.engine.isWebGPU;\n const textureNames = [\"depthSampler\", \"normalSampler\", \"positionSampler\", \"velocitySampler\"];\n const options = {\n width: this.scene.getEngine().getRenderWidth(),\n height: this.scene.getEngine().getRenderHeight(),\n samplingMode: 1,\n engine: this.scene.getEngine(),\n textureType: 0,\n textureFormat: 5,\n uniforms: [\"sizeParams\"],\n samplers: textureNames,\n reusable: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializations: (useWebGPU, list) => {\n if (useWebGPU) {\n list.push(import(\"../../ShadersWGSL/iblShadowGBufferDebug.fragment.js\"));\n } else {\n list.push(import(\"../../Shaders/iblShadowGBufferDebug.fragment.js\"));\n }\n }\n };\n this._gbufferDebugPass = new PostProcess(\"iblShadowGBufferDebug\", \"iblShadowGBufferDebug\", options);\n this._gbufferDebugPass.autoClear = false;\n this._gbufferDebugPass.onApplyObservable.add(effect => {\n const depthIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.SCREENSPACE_DEPTH_TEXTURE_TYPE);\n effect.setTexture(\"depthSampler\", this._geometryBufferRenderer.getGBuffer().textures[depthIndex]);\n const normalIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.NORMAL_TEXTURE_TYPE);\n effect.setTexture(\"normalSampler\", this._geometryBufferRenderer.getGBuffer().textures[normalIndex]);\n const positionIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\n effect.setTexture(\"positionSampler\", this._geometryBufferRenderer.getGBuffer().textures[positionIndex]);\n const velocityIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\n effect.setTexture(\"velocitySampler\", this._geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\n effect.setVector4(\"sizeParams\", this._gBufferDebugSizeParams);\n if (this.scene.activeCamera) {\n effect.setFloat(\"maxDepth\", this.scene.activeCamera.maxZ);\n }\n });\n return this._gbufferDebugPass;\n }\n _createDebugPasses() {\n this._debugPasses = [{\n pass: this._importanceSamplingRenderer.getDebugPassPP(),\n enabled: this.importanceSamplingDebugEnabled\n }, {\n pass: this._voxelRenderer.getDebugPassPP(),\n enabled: this.voxelDebugEnabled\n }, {\n pass: this._voxelTracingPass.getDebugPassPP(),\n enabled: this.voxelTracingDebugEnabled\n }, {\n pass: this._spatialBlurPass.getDebugPassPP(),\n enabled: this.spatialBlurPassDebugEnabled\n }, {\n pass: this._accumulationPass.getDebugPassPP(),\n enabled: this.accumulationPassDebugEnabled\n }, {\n pass: this._getGBufferDebugPass(),\n enabled: this.gbufferDebugEnabled\n }];\n for (let i = 0; i < this._debugPasses.length; i++) {\n if (!this._debugPasses[i].pass) continue;\n this.addEffect(new PostProcessRenderEffect(this.scene.getEngine(), this._debugPasses[i].pass.name, () => {\n return this._debugPasses[i].pass;\n }, true));\n }\n const cameras = this.cameras.slice();\n this.scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this.name, this.cameras);\n this.scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this.name, cameras);\n for (let i = 0; i < this._debugPasses.length; i++) {\n if (!this._debugPasses[i].pass) continue;\n if (this._debugPasses[i].enabled) {\n this._enableEffect(this._debugPasses[i].pass.name, this.cameras);\n } else {\n this._disableEffect(this._debugPasses[i].pass.name, this.cameras);\n }\n }\n }\n _disposeEffectPasses() {\n this.scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this.name, this.cameras);\n this._disposeDebugPasses();\n this._reset();\n }\n _disposeDebugPasses() {\n for (let i = 0; i < this._debugPasses.length; i++) {\n this._disableEffect(this._debugPasses[i].pass.name, this.cameras);\n this._debugPasses[i].pass.dispose();\n }\n this._debugPasses = [];\n }\n _updateDebugPasses() {\n let count = 0;\n if (this._gbufferDebugEnabled) count++;\n if (this.importanceSamplingDebugEnabled) count++;\n if (this.voxelDebugEnabled) count++;\n if (this.voxelTracingDebugEnabled) count++;\n if (this.spatialBlurPassDebugEnabled) count++;\n if (this.accumulationPassDebugEnabled) count++;\n const rows = Math.ceil(Math.sqrt(count));\n const cols = Math.ceil(count / rows);\n const width = 1.0 / cols;\n const height = 1.0 / rows;\n let x = 0;\n let y = 0;\n if (this.gbufferDebugEnabled) {\n this._gBufferDebugSizeParams.set(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.importanceSamplingDebugEnabled) {\n this._importanceSamplingRenderer.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.voxelDebugEnabled) {\n this._voxelRenderer.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.voxelTracingDebugEnabled) {\n this._voxelTracingPass.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.spatialBlurPassDebugEnabled) {\n this._spatialBlurPass.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.accumulationPassDebugEnabled) {\n this._accumulationPass.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n }\n /**\n * Update the SS shadow max distance and thickness based on the voxel grid size and resolution.\n * The max distance should be just a little larger than the world size of a single voxel.\n */\n _updateSSShadowParams() {\n this._voxelTracingPass.sssMaxDist = this._sssMaxDistScale * this.voxelGridSize / (1 << this.resolutionExp);\n this._voxelTracingPass.sssThickness = this._sssThicknessScale * 0.005 * this.voxelGridSize;\n }\n /**\n * Apply the shadows to a material or array of materials. If no material is provided, all\n * materials in the scene will be added.\n * @param material Material that will be affected by the shadows. If not provided, all materials of the scene will be affected.\n */\n addShadowReceivingMaterial(material) {\n if (material) {\n if (Array.isArray(material)) {\n material.forEach(m => {\n this._addShadowSupportToMaterial(m);\n });\n } else {\n this._addShadowSupportToMaterial(material);\n }\n } else {\n this.scene.materials.forEach(mat => {\n this._addShadowSupportToMaterial(mat);\n });\n }\n }\n /**\n * Remove a material from the list of materials that receive shadows. If no material\n * is provided, all materials in the scene will be removed.\n * @param material The material or array of materials that will no longer receive shadows\n */\n removeShadowReceivingMaterial(material) {\n if (Array.isArray(material)) {\n material.forEach(m => {\n const matIndex = this._materialsWithRenderPlugin.indexOf(m);\n if (matIndex !== -1) {\n var _m$pluginManager;\n this._materialsWithRenderPlugin.splice(matIndex, 1);\n const plugin = (_m$pluginManager = m.pluginManager) === null || _m$pluginManager === void 0 ? void 0 : _m$pluginManager.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.isEnabled = false;\n }\n });\n } else {\n const matIndex = this._materialsWithRenderPlugin.indexOf(material);\n if (matIndex !== -1) {\n this._materialsWithRenderPlugin.splice(matIndex, 1);\n const plugin = material.pluginManager.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.isEnabled = false;\n }\n }\n }\n _addShadowSupportToMaterial(material) {\n var _material$pluginManag;\n if (!(material instanceof PBRBaseMaterial) && !(material instanceof StandardMaterial)) {\n return;\n }\n let plugin = (_material$pluginManag = material.pluginManager) === null || _material$pluginManag === void 0 ? void 0 : _material$pluginManag.getPlugin(IBLShadowsPluginMaterial.Name);\n if (!plugin) {\n plugin = new IBLShadowsPluginMaterial(material);\n }\n if (this._materialsWithRenderPlugin.indexOf(material) !== -1) {\n return;\n }\n if (this._enabled) {\n plugin.iblShadowsTexture = this._getAccumulatedTexture().getInternalTexture();\n plugin.shadowOpacity = this.shadowOpacity;\n }\n plugin.isEnabled = this._enabled;\n this._materialsWithRenderPlugin.push(material);\n }\n _setPluginParameters() {\n if (!this._enabled) {\n return;\n }\n this._materialsWithRenderPlugin.forEach(mat => {\n if (mat.pluginManager) {\n const plugin = mat.pluginManager.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.iblShadowsTexture = this._getAccumulatedTexture().getInternalTexture();\n plugin.shadowOpacity = this.shadowOpacity;\n }\n });\n }\n _updateBeforeRender() {\n this._updateDebugPasses();\n }\n _listenForCameraChanges() {\n var _this$scene$activeCam;\n // We want to listen for camera changes and change settings while the camera is moving.\n (_this$scene$activeCam = this.scene.activeCamera) === null || _this$scene$activeCam === void 0 || _this$scene$activeCam.onViewMatrixChangedObservable.add(() => {\n this._accumulationPass.isMoving = true;\n });\n }\n /**\n * Checks if the IBL shadow pipeline is ready to render shadows\n * @returns true if the IBL shadow pipeline is ready to render the shadows\n */\n isReady() {\n return this._noiseTexture.isReady() && this._voxelRenderer.isReady() && this._importanceSamplingRenderer.isReady() && (!this._voxelTracingPass || this._voxelTracingPass.isReady()) && (!this._spatialBlurPass || this._spatialBlurPass.isReady()) && (!this._accumulationPass || this._accumulationPass.isReady());\n }\n /**\n * Get the class name\n * @returns \"IBLShadowsRenderPipeline\"\n */\n getClassName() {\n return \"IBLShadowsRenderPipeline\";\n }\n /**\n * Disposes the IBL shadow pipeline and associated resources\n */\n dispose() {\n const materials = this._materialsWithRenderPlugin.splice(0);\n materials.forEach(mat => {\n this.removeShadowReceivingMaterial(mat);\n });\n this._disposeEffectPasses();\n this._noiseTexture.dispose();\n this._voxelRenderer.dispose();\n this._importanceSamplingRenderer.dispose();\n this._voxelTracingPass.dispose();\n this._spatialBlurPass.dispose();\n this._accumulationPass.dispose();\n this._dummyTexture2d.dispose();\n this._dummyTexture3d.dispose();\n this.onNewIblReadyObservable.clear();\n this.onShadowTextureReadyObservable.clear();\n super.dispose();\n }\n}","map":{"version":3,"names":["EngineStore","Matrix","Vector3","Vector4","Quaternion","Texture","Logger","_IblShadowsVoxelRenderer","_IblShadowsVoxelTracingPass","PostProcess","_IblShadowsImportanceSamplingRenderer","_IblShadowsSpatialBlurPass","_IblShadowsAccumulationPass","PostProcessRenderPipeline","PostProcessRenderEffect","GeometryBufferRenderer","RawTexture","RawTexture3D","Engine","IBLShadowsPluginMaterial","PBRBaseMaterial","StandardMaterial","Observable","IblShadowsRenderPipeline","resetAccumulation","_accumulationPass","reset","shadowOpacity","_shadowOpacity","value","_setPluginParameters","shadowRenderSizeFactor","_renderSizeFactor","Math","max","min","_voxelTracingPass","resize","_spatialBlurPass","voxelShadowOpacity","_this$_voxelTracingPa","ssShadowOpacity","_this$_voxelTracingPa2","ssShadowSampleCount","_this$_voxelTracingPa3","sssSamples","ssShadowStride","_this$_voxelTracingPa4","sssStride","ssShadowDistanceScale","_sssMaxDistScale","_updateSSShadowParams","ssShadowThicknessScale","_sssThicknessScale","setIblTexture","iblSource","_importanceSamplingRenderer","_getVoxelGridTexture","_this$_voxelRenderer","tex","_voxelRenderer","getVoxelGrid","isReady","_dummyTexture3d","_getIcdfyTexture","getIcdfyTexture","_dummyTexture2d","_getIcdfxTexture","getIcdfxTexture","_getNoiseTexture","_noiseTexture","_getVoxelTracingTexture","_this$_voxelTracingPa5","getOutputTexture","_getSpatialBlurTexture","_getAccumulatedTexture","_this$_accumulationPa","gbufferDebugEnabled","_gbufferDebugEnabled","enabled","allowDebugPasses","Warn","_enableEffect","_getGBufferDebugPass","name","cameras","_disableEffect","importanceSamplingDebugEnabled","_this$_importanceSamp","debugEnabled","debugPassName","voxelDebugEnabled","_this$_voxelRenderer2","voxelDebugAxis","_this$_voxelRenderer3","axisNum","voxelDebugDisplayMip","mipNum","setDebugMipNumber","voxelTracingDebugEnabled","_this$_voxelTracingPa6","spatialBlurPassDebugEnabled","accumulationPassDebugEnabled","_this$_accumulationPa2","addShadowCastingMesh","mesh","Array","isArray","m","_shadowCastingMeshes","indexOf","push","removeShadowCastingMesh","index","splice","resolutionExp","voxelResolutionExp","newResolution","isVoxelizationInProgress","sampleDirections","_this$_voxelTracingPa7","shadowRemanence","_this$_accumulationPa3","remanence","envRotation","_this$_voxelTracingPa8","_allowDebugPasses","_createDebugPasses","onReadyObservable","addOnce","_disposeDebugPasses","IsSupported","engine","LastCreatedEngine","_features","supportIBLShadows","toggleShadow","_enabled","_materialsWithRenderPlugin","forEach","mat","pluginManager","plugin","getPlugin","Name","isEnabled","updateVoxelization","length","updateVoxelGrid","updateSceneBounds","bounds","Number","MAX_VALUE","localBounds","getHierarchyBoundingVectors","Minimize","Maximize","size","subtract","voxelGridSize","x","y","z","isFinite","halfSize","centre","add","multiplyByFloats","invWorldScaleMatrix","Compose","invTranslationMatrix","multiplyToRef","setWorldScaleMatrix","setWorldScale","constructor","scene","options","_options$voxelShadowO","_options$envRotation","_options$shadowRemane","getEngine","_debugPasses","onShadowTextureReadyObservable","onNewIblReadyObservable","_gBufferDebugSizeParams","_cameras","activeCamera","blackPixels","Uint8Array","TEXTUREFORMAT_RGBA","textureTypesAndFormats","SCREENSPACE_DEPTH_TEXTURE_TYPE","textureFormat","textureType","VELOCITY_LINEAR_TEXTURE_TYPE","POSITION_TEXTURE_TYPE","NORMAL_TEXTURE_TYPE","geometryBufferRenderer","enableGeometryBufferRenderer","undefined","Error","_geometryBufferRenderer","enableScreenspaceDepth","enableVelocityLinear","enablePosition","enableNormal","generateNormalsInWorldSpace","triPlanarVoxelization","notifyObservers","ssShadowsEnabled","environmentTexture","postProcessRenderPipelineManager","addPipeline","onActiveCameraChanged","_listenForCameraChanges","bind","onBeforeRenderObservable","_updateBeforeRender","onResizeObservable","_handleResize","_gbufferDebugPass","isWebGPU","textureNames","width","getRenderWidth","height","getRenderHeight","samplingMode","uniforms","samplers","reusable","shaderLanguage","extraInitializations","useWebGPU","list","autoClear","onApplyObservable","effect","depthIndex","getTextureIndex","setTexture","getGBuffer","textures","normalIndex","positionIndex","velocityIndex","setVector4","setFloat","maxZ","pass","getDebugPassPP","i","addEffect","slice","detachCamerasFromRenderPipeline","attachCamerasToRenderPipeline","_disposeEffectPasses","_reset","dispose","_updateDebugPasses","count","rows","ceil","sqrt","cols","set","setDebugDisplayParams","sssMaxDist","sssThickness","addShadowReceivingMaterial","material","_addShadowSupportToMaterial","materials","removeShadowReceivingMaterial","matIndex","_m$pluginManager","_material$pluginManag","iblShadowsTexture","getInternalTexture","_this$scene$activeCam","onViewMatrixChangedObservable","isMoving","getClassName","clear"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Rendering/IBLShadows/iblShadowsRenderPipeline.js"],"sourcesContent":["\nimport { EngineStore } from \"../../Engines/engineStore.js\";\nimport { Matrix, Vector3, Vector4, Quaternion } from \"../../Maths/math.vector.js\";\nimport { Texture } from \"../../Materials/Textures/texture.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { _IblShadowsVoxelRenderer } from \"./iblShadowsVoxelRenderer.js\";\nimport { _IblShadowsVoxelTracingPass } from \"./iblShadowsVoxelTracingPass.js\";\nimport { PostProcess } from \"../../PostProcesses/postProcess.js\";\nimport { _IblShadowsImportanceSamplingRenderer } from \"./iblShadowsImportanceSamplingRenderer.js\";\nimport { _IblShadowsSpatialBlurPass } from \"./iblShadowsSpatialBlurPass.js\";\nimport { _IblShadowsAccumulationPass } from \"./iblShadowsAccumulationPass.js\";\nimport { PostProcessRenderPipeline } from \"../../PostProcesses/RenderPipeline/postProcessRenderPipeline.js\";\nimport { PostProcessRenderEffect } from \"../../PostProcesses/RenderPipeline/postProcessRenderEffect.js\";\nimport { GeometryBufferRenderer } from \"../geometryBufferRenderer.js\";\nimport { RawTexture } from \"../../Materials/Textures/rawTexture.js\";\nimport { RawTexture3D } from \"../../Materials/Textures/rawTexture3D.js\";\nimport { Engine } from \"../../Engines/engine.js\";\nimport { IBLShadowsPluginMaterial } from \"./iblShadowsPluginMaterial.js\";\nimport { PBRBaseMaterial } from \"../../Materials/PBR/pbrBaseMaterial.js\";\nimport { StandardMaterial } from \"../../Materials/standardMaterial.js\";\nimport { Observable } from \"../../Misc/observable.js\";\n/**\n * Voxel-based shadow rendering for IBL's.\n * This should not be instanciated directly, as it is part of a scene component\n */\nexport class IblShadowsRenderPipeline extends PostProcessRenderPipeline {\n /**\n * Reset the shadow accumulation. This has a similar affect to lowering the remanence for a single frame.\n * This is useful when making a sudden change to the IBL.\n */\n resetAccumulation() {\n this._accumulationPass.reset = true;\n }\n /**\n * How dark the shadows appear. 1.0 is full opacity, 0.0 is no shadows.\n */\n get shadowOpacity() {\n return this._shadowOpacity;\n }\n set shadowOpacity(value) {\n this._shadowOpacity = value;\n this._setPluginParameters();\n }\n /**\n * A multiplier for the render size of the shadows. Used for rendering lower-resolution shadows.\n */\n get shadowRenderSizeFactor() {\n return this._renderSizeFactor;\n }\n set shadowRenderSizeFactor(value) {\n this._renderSizeFactor = Math.max(Math.min(value, 1.0), 0.0);\n this._voxelTracingPass.resize(value);\n this._spatialBlurPass.resize(value);\n this._accumulationPass.resize(value);\n this._setPluginParameters();\n }\n /**\n * How dark the voxel shadows appear. 1.0 is full opacity, 0.0 is no shadows.\n */\n get voxelShadowOpacity() {\n return this._voxelTracingPass?.voxelShadowOpacity;\n }\n set voxelShadowOpacity(value) {\n if (!this._voxelTracingPass)\n return;\n this._voxelTracingPass.voxelShadowOpacity = value;\n }\n /**\n * How dark the screen-space shadows appear. 1.0 is full opacity, 0.0 is no shadows.\n */\n get ssShadowOpacity() {\n return this._voxelTracingPass?.ssShadowOpacity;\n }\n set ssShadowOpacity(value) {\n if (!this._voxelTracingPass)\n return;\n this._voxelTracingPass.ssShadowOpacity = value;\n }\n /**\n * The number of samples used in the screen space shadow pass.\n */\n get ssShadowSampleCount() {\n return this._voxelTracingPass?.sssSamples;\n }\n set ssShadowSampleCount(value) {\n if (!this._voxelTracingPass)\n return;\n this._voxelTracingPass.sssSamples = value;\n }\n /**\n * The stride of the screen-space shadow pass. This controls the distance between samples\n * in pixels.\n */\n get ssShadowStride() {\n return this._voxelTracingPass?.sssStride;\n }\n set ssShadowStride(value) {\n if (!this._voxelTracingPass)\n return;\n this._voxelTracingPass.sssStride = value;\n }\n /**\n * A scale for the maximum distance a screen-space shadow can be cast in world-space.\n * The maximum distance that screen-space shadows cast is derived from the voxel size\n * and this value so shouldn't need to change if you scale your scene\n */\n get ssShadowDistanceScale() {\n return this._sssMaxDistScale;\n }\n set ssShadowDistanceScale(value) {\n this._sssMaxDistScale = value;\n this._updateSSShadowParams();\n }\n /**\n * Screen-space shadow thickness scale. This value controls the assumed thickness of\n * on-screen surfaces in world-space. It scales with the size of the shadow-casting\n * region so shouldn't need to change if you scale your scene.\n */\n get ssShadowThicknessScale() {\n return this._sssThicknessScale;\n }\n set ssShadowThicknessScale(value) {\n this._sssThicknessScale = value;\n this._updateSSShadowParams();\n }\n /**\n * Set the IBL image to be used for shadowing. It can be either a cubemap\n * or a 2D equirectangular texture.\n * @param iblSource The texture to use for IBL shadowing\n */\n setIblTexture(iblSource) {\n if (!this._importanceSamplingRenderer)\n return;\n this._importanceSamplingRenderer.iblSource = iblSource;\n }\n /**\n * Returns the texture containing the voxel grid data\n * @returns The texture containing the voxel grid data\n * @internal\n */\n _getVoxelGridTexture() {\n const tex = this._voxelRenderer?.getVoxelGrid();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture3d;\n }\n /**\n * Returns the texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @returns The texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @internal\n */\n _getIcdfyTexture() {\n const tex = this._importanceSamplingRenderer.getIcdfyTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @returns The texture containing the importance sampling CDF data for the IBL shadow pipeline\n * @internal\n */\n _getIcdfxTexture() {\n const tex = this._importanceSamplingRenderer.getIcdfxTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the noise texture.\n * @returns The noise texture.\n * @internal\n */\n _getNoiseTexture() {\n const tex = this._noiseTexture;\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the voxel-tracing texture.\n * @returns The voxel-tracing texture.\n * @internal\n */\n _getVoxelTracingTexture() {\n const tex = this._voxelTracingPass?.getOutputTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the spatial blur texture.\n * @returns The spatial blur texture.\n * @internal\n */\n _getSpatialBlurTexture() {\n const tex = this._spatialBlurPass.getOutputTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Returns the accumulated shadow texture.\n * @returns The accumulated shadow texture.\n * @internal\n */\n _getAccumulatedTexture() {\n const tex = this._accumulationPass?.getOutputTexture();\n if (tex && tex.isReady()) {\n return tex;\n }\n return this._dummyTexture2d;\n }\n /**\n * Turn on or off the debug view of the G-Buffer. This will display only the targets\n * of the g-buffer that are used by the shadow pipeline.\n */\n get gbufferDebugEnabled() {\n return this._gbufferDebugEnabled;\n }\n set gbufferDebugEnabled(enabled) {\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable G-Buffer debug view without setting allowDebugPasses to true.\");\n return;\n }\n this._gbufferDebugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._getGBufferDebugPass().name, this.cameras);\n }\n else {\n this._disableEffect(this._getGBufferDebugPass().name, this.cameras);\n }\n }\n /**\n * Turn on or off the debug view of the CDF importance sampling data\n */\n get importanceSamplingDebugEnabled() {\n return this._importanceSamplingRenderer?.debugEnabled;\n }\n /**\n * Turn on or off the debug view of the CDF importance sampling data\n */\n set importanceSamplingDebugEnabled(enabled) {\n if (!this._importanceSamplingRenderer)\n return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable importance sampling debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._importanceSamplingRenderer.debugEnabled)\n return;\n this._importanceSamplingRenderer.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._importanceSamplingRenderer.debugPassName, this.cameras);\n }\n else {\n this._disableEffect(this._importanceSamplingRenderer.debugPassName, this.cameras);\n }\n }\n /**\n * This displays the voxel grid in slices spread across the screen.\n * It also displays what slices of the model are stored in each layer\n * of the voxel grid. Each red stripe represents one layer while each gradient\n * (from bright red to black) represents the layers rendered in a single draw call.\n */\n get voxelDebugEnabled() {\n return this._voxelRenderer?.voxelDebugEnabled;\n }\n set voxelDebugEnabled(enabled) {\n if (!this._voxelRenderer)\n return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable voxel debug view without setting allowDebugPasses to true.\");\n return;\n }\n this._voxelRenderer.voxelDebugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._voxelRenderer.debugPassName, this.cameras);\n }\n else {\n this._disableEffect(this._voxelRenderer.debugPassName, this.cameras);\n }\n }\n /**\n * When using tri-planar voxelization (the default), this value can be used to\n * display only the voxelization result for that axis. z-axis = 0, y-axis = 1, x-axis = 2\n */\n get voxelDebugAxis() {\n return this._voxelRenderer?.voxelDebugAxis;\n }\n set voxelDebugAxis(axisNum) {\n if (!this._voxelRenderer)\n return;\n this._voxelRenderer.voxelDebugAxis = axisNum;\n }\n /**\n * Displays a given mip of the voxel grid. `voxelDebugAxis` must be undefined in this\n * case because we only generate mips for the combined voxel grid.\n */\n set voxelDebugDisplayMip(mipNum) {\n if (!this._voxelRenderer)\n return;\n this._voxelRenderer.setDebugMipNumber(mipNum);\n }\n /**\n * Display the debug view for just the shadow samples taken this frame.\n */\n get voxelTracingDebugEnabled() {\n return this._voxelTracingPass?.debugEnabled;\n }\n set voxelTracingDebugEnabled(enabled) {\n if (!this._voxelTracingPass)\n return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable voxel tracing debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._voxelTracingPass.debugEnabled)\n return;\n this._voxelTracingPass.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._voxelTracingPass.debugPassName, this.cameras);\n }\n else {\n this._disableEffect(this._voxelTracingPass.debugPassName, this.cameras);\n }\n }\n /**\n * Display the debug view for the spatial blur pass\n */\n get spatialBlurPassDebugEnabled() {\n return this._spatialBlurPass.debugEnabled;\n }\n set spatialBlurPassDebugEnabled(enabled) {\n if (!this._spatialBlurPass)\n return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable spatial blur debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._spatialBlurPass.debugEnabled)\n return;\n this._spatialBlurPass.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._spatialBlurPass.debugPassName, this.cameras);\n }\n else {\n this._disableEffect(this._spatialBlurPass.debugPassName, this.cameras);\n }\n }\n /**\n * Display the debug view for the shadows accumulated over time.\n */\n get accumulationPassDebugEnabled() {\n return this._accumulationPass?.debugEnabled;\n }\n set accumulationPassDebugEnabled(enabled) {\n if (!this._accumulationPass)\n return;\n if (enabled && !this.allowDebugPasses) {\n Logger.Warn(\"Can't enable accumulation pass debug view without setting allowDebugPasses to true.\");\n return;\n }\n if (enabled === this._accumulationPass.debugEnabled)\n return;\n this._accumulationPass.debugEnabled = enabled;\n if (enabled) {\n this._enableEffect(this._accumulationPass.debugPassName, this.cameras);\n }\n else {\n this._disableEffect(this._accumulationPass.debugPassName, this.cameras);\n }\n }\n /**\n * Add a mesh to be used for shadow-casting in the IBL shadow pipeline.\n * These meshes will be written to the voxel grid.\n * @param mesh A mesh or list of meshes that you want to cast shadows\n */\n addShadowCastingMesh(mesh) {\n if (Array.isArray(mesh)) {\n for (const m of mesh) {\n if (m && this._shadowCastingMeshes.indexOf(m) === -1) {\n this._shadowCastingMeshes.push(m);\n }\n }\n }\n else {\n if (mesh && this._shadowCastingMeshes.indexOf(mesh) === -1) {\n this._shadowCastingMeshes.push(mesh);\n }\n }\n }\n /**\n * Remove a mesh from the shadow-casting list. The mesh will no longer be written\n * to the voxel grid and will not cast shadows.\n * @param mesh The mesh or list of meshes that you don't want to cast shadows.\n */\n removeShadowCastingMesh(mesh) {\n if (Array.isArray(mesh)) {\n for (const m of mesh) {\n const index = this._shadowCastingMeshes.indexOf(m);\n if (index !== -1) {\n this._shadowCastingMeshes.splice(index, 1);\n }\n }\n }\n else {\n const index = this._shadowCastingMeshes.indexOf(mesh);\n if (index !== -1) {\n this._shadowCastingMeshes.splice(index, 1);\n }\n }\n }\n /**\n * The exponent of the resolution of the voxel shadow grid. Higher resolutions will result in sharper\n * shadows but are more expensive to compute and require more memory.\n * The resolution is calculated as 2 to the power of this number.\n */\n get resolutionExp() {\n return this._voxelRenderer.voxelResolutionExp;\n }\n set resolutionExp(newResolution) {\n if (newResolution === this._voxelRenderer.voxelResolutionExp)\n return;\n if (this._voxelRenderer.isVoxelizationInProgress()) {\n Logger.Warn(\"Can't change the resolution of the voxel grid while voxelization is in progress.\");\n return;\n }\n this._voxelRenderer.voxelResolutionExp = Math.max(1, Math.min(newResolution, 8));\n this._accumulationPass.reset = true;\n }\n /**\n * The number of different directions to sample during the voxel tracing pass\n */\n get sampleDirections() {\n return this._voxelTracingPass?.sampleDirections;\n }\n /**\n * The number of different directions to sample during the voxel tracing pass\n */\n set sampleDirections(value) {\n if (!this._voxelTracingPass)\n return;\n this._voxelTracingPass.sampleDirections = value;\n }\n /**\n * The decree to which the shadows persist between frames. 0.0 is no persistence, 1.0 is full persistence.\n **/\n get shadowRemanence() {\n return this._accumulationPass?.remanence;\n }\n /**\n * The decree to which the shadows persist between frames. 0.0 is no persistence, 1.0 is full persistence.\n **/\n set shadowRemanence(value) {\n if (!this._accumulationPass)\n return;\n this._accumulationPass.remanence = value;\n }\n /**\n * The global Y-axis rotation of the IBL for shadows. This should match the Y-rotation of the environment map applied to materials, skybox, etc.\n */\n get envRotation() {\n return this._voxelTracingPass?.envRotation;\n }\n /**\n * The global Y-axis rotation of the IBL for shadows. This should match the Y-rotation of the environment map applied to materials, skybox, etc.\n */\n set envRotation(value) {\n if (!this._voxelTracingPass)\n return;\n this._voxelTracingPass.envRotation = value;\n this._accumulationPass.reset = true;\n }\n /**\n * Allow debug passes to be enabled. Default is false.\n */\n get allowDebugPasses() {\n return this._allowDebugPasses;\n }\n /**\n * Allow debug passes to be enabled. Default is false.\n */\n set allowDebugPasses(value) {\n if (this._allowDebugPasses === value)\n return;\n this._allowDebugPasses = value;\n if (value) {\n if (this._importanceSamplingRenderer.isReady()) {\n this._createDebugPasses();\n }\n else {\n this._importanceSamplingRenderer.onReadyObservable.addOnce(() => {\n this._createDebugPasses();\n });\n }\n }\n else {\n this._disposeDebugPasses();\n }\n }\n /**\n * Support test.\n */\n static get IsSupported() {\n const engine = EngineStore.LastCreatedEngine;\n if (!engine) {\n return false;\n }\n return engine._features.supportIBLShadows;\n }\n /**\n * Toggle the shadow tracing on or off\n * @param enabled Toggle the shadow tracing on or off\n */\n toggleShadow(enabled) {\n this._enabled = enabled;\n this._voxelTracingPass.enabled = enabled;\n this._spatialBlurPass.enabled = enabled;\n this._accumulationPass.enabled = enabled;\n this._materialsWithRenderPlugin.forEach((mat) => {\n if (mat.pluginManager) {\n const plugin = mat.pluginManager.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.isEnabled = enabled;\n }\n });\n this._setPluginParameters();\n }\n /**\n * Trigger the scene to be re-voxelized. This should be run when any shadow-casters have been added, removed or moved.\n */\n updateVoxelization() {\n if (this._shadowCastingMeshes.length === 0) {\n Logger.Warn(\"IBL Shadows: updateVoxelization called with no shadow-casting meshes to voxelize.\");\n return;\n }\n this._voxelRenderer.updateVoxelGrid(this._shadowCastingMeshes);\n this._updateSSShadowParams();\n }\n /**\n * Trigger the scene bounds of shadow-casters to be calculated. This is the world size that the voxel grid will cover and will always be a cube.\n */\n updateSceneBounds() {\n const bounds = {\n min: new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE),\n max: new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE),\n };\n this._shadowCastingMeshes.forEach((mesh) => {\n const localBounds = mesh.getHierarchyBoundingVectors(true);\n bounds.min = Vector3.Minimize(bounds.min, localBounds.min);\n bounds.max = Vector3.Maximize(bounds.max, localBounds.max);\n });\n const size = bounds.max.subtract(bounds.min);\n this.voxelGridSize = Math.max(size.x, size.y, size.z);\n if (this._shadowCastingMeshes.length === 0 || !isFinite(this.voxelGridSize) || this.voxelGridSize === 0) {\n Logger.Warn(\"IBL Shadows: Scene size is invalid. Can't update bounds.\");\n this.voxelGridSize = 1.0;\n return;\n }\n const halfSize = this.voxelGridSize / 2.0;\n const centre = bounds.max.add(bounds.min).multiplyByFloats(-0.5, -0.5, -0.5);\n const invWorldScaleMatrix = Matrix.Compose(new Vector3(1.0 / halfSize, 1.0 / halfSize, 1.0 / halfSize), new Quaternion(), new Vector3(0, 0, 0));\n const invTranslationMatrix = Matrix.Compose(new Vector3(1.0, 1.0, 1.0), new Quaternion(), centre);\n invTranslationMatrix.multiplyToRef(invWorldScaleMatrix, invWorldScaleMatrix);\n this._voxelTracingPass.setWorldScaleMatrix(invWorldScaleMatrix);\n this._voxelRenderer.setWorldScaleMatrix(invWorldScaleMatrix);\n // Set world scale for spatial blur.\n this._spatialBlurPass.setWorldScale(halfSize * 2.0);\n this._updateSSShadowParams();\n }\n /**\n * @param name The rendering pipeline name\n * @param scene The scene linked to this pipeline\n * @param options Options to configure the pipeline\n * @param cameras Cameras to apply the pipeline to.\n */\n constructor(name, scene, options = {}, cameras) {\n super(scene.getEngine(), name);\n this._allowDebugPasses = false;\n this._debugPasses = [];\n this._shadowCastingMeshes = [];\n this._shadowOpacity = 0.8;\n this._enabled = true;\n this._materialsWithRenderPlugin = [];\n /**\n * Observable that triggers when the shadow renderer is ready\n */\n this.onShadowTextureReadyObservable = new Observable();\n /**\n * Observable that triggers when a new IBL is set and the importance sampling is ready\n */\n this.onNewIblReadyObservable = new Observable();\n /**\n * The current world-space size of that the voxel grid covers in the scene.\n */\n this.voxelGridSize = 1.0;\n this._renderSizeFactor = 1.0;\n this._gbufferDebugEnabled = false;\n this._gBufferDebugSizeParams = new Vector4(0.0, 0.0, 0.0, 0.0);\n this.scene = scene;\n this._cameras = cameras || [scene.activeCamera];\n // Create the dummy textures to be used when the pipeline is not ready\n const blackPixels = new Uint8Array([0, 0, 0, 255]);\n this._dummyTexture2d = new RawTexture(blackPixels, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false);\n this._dummyTexture3d = new RawTexture3D(blackPixels, 1, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false);\n // Setup the geometry buffer target formats\n const textureTypesAndFormats = {};\n textureTypesAndFormats[GeometryBufferRenderer.SCREENSPACE_DEPTH_TEXTURE_TYPE] = {\n textureFormat: 6,\n textureType: 1,\n };\n textureTypesAndFormats[GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE] = {\n textureFormat: 7,\n textureType: 2,\n };\n textureTypesAndFormats[GeometryBufferRenderer.POSITION_TEXTURE_TYPE] = {\n textureFormat: 5,\n textureType: 2,\n };\n textureTypesAndFormats[GeometryBufferRenderer.NORMAL_TEXTURE_TYPE] = {\n textureFormat: 5,\n textureType: 2,\n };\n const geometryBufferRenderer = scene.enableGeometryBufferRenderer(undefined, 14, textureTypesAndFormats);\n if (!geometryBufferRenderer) {\n Logger.Error(\"Geometry buffer renderer is required for IBL shadows to work.\");\n return;\n }\n this._geometryBufferRenderer = geometryBufferRenderer;\n this._geometryBufferRenderer.enableScreenspaceDepth = true;\n this._geometryBufferRenderer.enableVelocityLinear = true;\n this._geometryBufferRenderer.enablePosition = true;\n this._geometryBufferRenderer.enableNormal = true;\n this._geometryBufferRenderer.generateNormalsInWorldSpace = true;\n this.shadowOpacity = options.shadowOpacity || 0.8;\n this._voxelRenderer = new _IblShadowsVoxelRenderer(this.scene, this, options ? options.resolutionExp : 6, options.triPlanarVoxelization !== undefined ? options.triPlanarVoxelization : true);\n this._importanceSamplingRenderer = new _IblShadowsImportanceSamplingRenderer(this.scene);\n this._voxelTracingPass = new _IblShadowsVoxelTracingPass(this.scene, this);\n this._spatialBlurPass = new _IblShadowsSpatialBlurPass(this.scene, this);\n this._accumulationPass = new _IblShadowsAccumulationPass(this.scene, this);\n this._accumulationPass.onReadyObservable.addOnce(() => {\n this.onShadowTextureReadyObservable.notifyObservers();\n });\n this.sampleDirections = options.sampleDirections || 2;\n this.voxelShadowOpacity = options.voxelShadowOpacity ?? 1.0;\n this.envRotation = options.envRotation ?? 0.0;\n this.shadowRenderSizeFactor = options.shadowRenderSizeFactor || 1.0;\n this.ssShadowOpacity = options.ssShadowsEnabled === undefined || options.ssShadowsEnabled ? 1.0 : 0.0;\n this.ssShadowDistanceScale = options.ssShadowDistanceScale || 1.25;\n this.ssShadowSampleCount = options.ssShadowSampleCount || 16;\n this.ssShadowStride = options.ssShadowStride || 8;\n this.ssShadowThicknessScale = options.ssShadowThicknessScale || 1.0;\n this.shadowRemanence = options.shadowRemanence ?? 0.75;\n this._noiseTexture = new Texture(\"https://assets.babylonjs.com/textures/blue_noise/blue_noise_rgb.png\", this.scene, false, true, 1);\n if (this.scene.environmentTexture) {\n this._importanceSamplingRenderer.iblSource = this.scene.environmentTexture;\n }\n scene.postProcessRenderPipelineManager.addPipeline(this);\n this.scene.onActiveCameraChanged.add(this._listenForCameraChanges.bind(this));\n this.scene.onBeforeRenderObservable.add(this._updateBeforeRender.bind(this));\n this._listenForCameraChanges();\n this.scene.getEngine().onResizeObservable.add(this._handleResize.bind(this));\n // Assigning the shadow texture to the materials needs to be done after the RT's are created.\n this._importanceSamplingRenderer.onReadyObservable.add(() => {\n this._setPluginParameters();\n this.onNewIblReadyObservable.notifyObservers();\n });\n }\n _handleResize() {\n this._voxelRenderer.resize();\n this._voxelTracingPass.resize(this.shadowRenderSizeFactor);\n this._spatialBlurPass.resize(this.shadowRenderSizeFactor);\n this._accumulationPass.resize(this.shadowRenderSizeFactor);\n this._setPluginParameters();\n }\n _getGBufferDebugPass() {\n if (this._gbufferDebugPass) {\n return this._gbufferDebugPass;\n }\n const isWebGPU = this.engine.isWebGPU;\n const textureNames = [\"depthSampler\", \"normalSampler\", \"positionSampler\", \"velocitySampler\"];\n const options = {\n width: this.scene.getEngine().getRenderWidth(),\n height: this.scene.getEngine().getRenderHeight(),\n samplingMode: 1,\n engine: this.scene.getEngine(),\n textureType: 0,\n textureFormat: 5,\n uniforms: [\"sizeParams\"],\n samplers: textureNames,\n reusable: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializations: (useWebGPU, list) => {\n if (useWebGPU) {\n list.push(import(\"../../ShadersWGSL/iblShadowGBufferDebug.fragment.js\"));\n }\n else {\n list.push(import(\"../../Shaders/iblShadowGBufferDebug.fragment.js\"));\n }\n },\n };\n this._gbufferDebugPass = new PostProcess(\"iblShadowGBufferDebug\", \"iblShadowGBufferDebug\", options);\n this._gbufferDebugPass.autoClear = false;\n this._gbufferDebugPass.onApplyObservable.add((effect) => {\n const depthIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.SCREENSPACE_DEPTH_TEXTURE_TYPE);\n effect.setTexture(\"depthSampler\", this._geometryBufferRenderer.getGBuffer().textures[depthIndex]);\n const normalIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.NORMAL_TEXTURE_TYPE);\n effect.setTexture(\"normalSampler\", this._geometryBufferRenderer.getGBuffer().textures[normalIndex]);\n const positionIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\n effect.setTexture(\"positionSampler\", this._geometryBufferRenderer.getGBuffer().textures[positionIndex]);\n const velocityIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\n effect.setTexture(\"velocitySampler\", this._geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\n effect.setVector4(\"sizeParams\", this._gBufferDebugSizeParams);\n if (this.scene.activeCamera) {\n effect.setFloat(\"maxDepth\", this.scene.activeCamera.maxZ);\n }\n });\n return this._gbufferDebugPass;\n }\n _createDebugPasses() {\n this._debugPasses = [\n { pass: this._importanceSamplingRenderer.getDebugPassPP(), enabled: this.importanceSamplingDebugEnabled },\n { pass: this._voxelRenderer.getDebugPassPP(), enabled: this.voxelDebugEnabled },\n { pass: this._voxelTracingPass.getDebugPassPP(), enabled: this.voxelTracingDebugEnabled },\n { pass: this._spatialBlurPass.getDebugPassPP(), enabled: this.spatialBlurPassDebugEnabled },\n { pass: this._accumulationPass.getDebugPassPP(), enabled: this.accumulationPassDebugEnabled },\n { pass: this._getGBufferDebugPass(), enabled: this.gbufferDebugEnabled },\n ];\n for (let i = 0; i < this._debugPasses.length; i++) {\n if (!this._debugPasses[i].pass)\n continue;\n this.addEffect(new PostProcessRenderEffect(this.scene.getEngine(), this._debugPasses[i].pass.name, () => {\n return this._debugPasses[i].pass;\n }, true));\n }\n const cameras = this.cameras.slice();\n this.scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this.name, this.cameras);\n this.scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this.name, cameras);\n for (let i = 0; i < this._debugPasses.length; i++) {\n if (!this._debugPasses[i].pass)\n continue;\n if (this._debugPasses[i].enabled) {\n this._enableEffect(this._debugPasses[i].pass.name, this.cameras);\n }\n else {\n this._disableEffect(this._debugPasses[i].pass.name, this.cameras);\n }\n }\n }\n _disposeEffectPasses() {\n this.scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this.name, this.cameras);\n this._disposeDebugPasses();\n this._reset();\n }\n _disposeDebugPasses() {\n for (let i = 0; i < this._debugPasses.length; i++) {\n this._disableEffect(this._debugPasses[i].pass.name, this.cameras);\n this._debugPasses[i].pass.dispose();\n }\n this._debugPasses = [];\n }\n _updateDebugPasses() {\n let count = 0;\n if (this._gbufferDebugEnabled)\n count++;\n if (this.importanceSamplingDebugEnabled)\n count++;\n if (this.voxelDebugEnabled)\n count++;\n if (this.voxelTracingDebugEnabled)\n count++;\n if (this.spatialBlurPassDebugEnabled)\n count++;\n if (this.accumulationPassDebugEnabled)\n count++;\n const rows = Math.ceil(Math.sqrt(count));\n const cols = Math.ceil(count / rows);\n const width = 1.0 / cols;\n const height = 1.0 / rows;\n let x = 0;\n let y = 0;\n if (this.gbufferDebugEnabled) {\n this._gBufferDebugSizeParams.set(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.importanceSamplingDebugEnabled) {\n this._importanceSamplingRenderer.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.voxelDebugEnabled) {\n this._voxelRenderer.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.voxelTracingDebugEnabled) {\n this._voxelTracingPass.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.spatialBlurPassDebugEnabled) {\n this._spatialBlurPass.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n if (this.accumulationPassDebugEnabled) {\n this._accumulationPass.setDebugDisplayParams(x, y, cols, rows);\n x -= width;\n if (x <= -1) {\n x = 0;\n y -= height;\n }\n }\n }\n /**\n * Update the SS shadow max distance and thickness based on the voxel grid size and resolution.\n * The max distance should be just a little larger than the world size of a single voxel.\n */\n _updateSSShadowParams() {\n this._voxelTracingPass.sssMaxDist = (this._sssMaxDistScale * this.voxelGridSize) / (1 << this.resolutionExp);\n this._voxelTracingPass.sssThickness = this._sssThicknessScale * 0.005 * this.voxelGridSize;\n }\n /**\n * Apply the shadows to a material or array of materials. If no material is provided, all\n * materials in the scene will be added.\n * @param material Material that will be affected by the shadows. If not provided, all materials of the scene will be affected.\n */\n addShadowReceivingMaterial(material) {\n if (material) {\n if (Array.isArray(material)) {\n material.forEach((m) => {\n this._addShadowSupportToMaterial(m);\n });\n }\n else {\n this._addShadowSupportToMaterial(material);\n }\n }\n else {\n this.scene.materials.forEach((mat) => {\n this._addShadowSupportToMaterial(mat);\n });\n }\n }\n /**\n * Remove a material from the list of materials that receive shadows. If no material\n * is provided, all materials in the scene will be removed.\n * @param material The material or array of materials that will no longer receive shadows\n */\n removeShadowReceivingMaterial(material) {\n if (Array.isArray(material)) {\n material.forEach((m) => {\n const matIndex = this._materialsWithRenderPlugin.indexOf(m);\n if (matIndex !== -1) {\n this._materialsWithRenderPlugin.splice(matIndex, 1);\n const plugin = m.pluginManager?.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.isEnabled = false;\n }\n });\n }\n else {\n const matIndex = this._materialsWithRenderPlugin.indexOf(material);\n if (matIndex !== -1) {\n this._materialsWithRenderPlugin.splice(matIndex, 1);\n const plugin = material.pluginManager.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.isEnabled = false;\n }\n }\n }\n _addShadowSupportToMaterial(material) {\n if (!(material instanceof PBRBaseMaterial) && !(material instanceof StandardMaterial)) {\n return;\n }\n let plugin = material.pluginManager?.getPlugin(IBLShadowsPluginMaterial.Name);\n if (!plugin) {\n plugin = new IBLShadowsPluginMaterial(material);\n }\n if (this._materialsWithRenderPlugin.indexOf(material) !== -1) {\n return;\n }\n if (this._enabled) {\n plugin.iblShadowsTexture = this._getAccumulatedTexture().getInternalTexture();\n plugin.shadowOpacity = this.shadowOpacity;\n }\n plugin.isEnabled = this._enabled;\n this._materialsWithRenderPlugin.push(material);\n }\n _setPluginParameters() {\n if (!this._enabled) {\n return;\n }\n this._materialsWithRenderPlugin.forEach((mat) => {\n if (mat.pluginManager) {\n const plugin = mat.pluginManager.getPlugin(IBLShadowsPluginMaterial.Name);\n plugin.iblShadowsTexture = this._getAccumulatedTexture().getInternalTexture();\n plugin.shadowOpacity = this.shadowOpacity;\n }\n });\n }\n _updateBeforeRender() {\n this._updateDebugPasses();\n }\n _listenForCameraChanges() {\n // We want to listen for camera changes and change settings while the camera is moving.\n this.scene.activeCamera?.onViewMatrixChangedObservable.add(() => {\n this._accumulationPass.isMoving = true;\n });\n }\n /**\n * Checks if the IBL shadow pipeline is ready to render shadows\n * @returns true if the IBL shadow pipeline is ready to render the shadows\n */\n isReady() {\n return (this._noiseTexture.isReady() &&\n this._voxelRenderer.isReady() &&\n this._importanceSamplingRenderer.isReady() &&\n (!this._voxelTracingPass || this._voxelTracingPass.isReady()) &&\n (!this._spatialBlurPass || this._spatialBlurPass.isReady()) &&\n (!this._accumulationPass || this._accumulationPass.isReady()));\n }\n /**\n * Get the class name\n * @returns \"IBLShadowsRenderPipeline\"\n */\n getClassName() {\n return \"IBLShadowsRenderPipeline\";\n }\n /**\n * Disposes the IBL shadow pipeline and associated resources\n */\n dispose() {\n const materials = this._materialsWithRenderPlugin.splice(0);\n materials.forEach((mat) => {\n this.removeShadowReceivingMaterial(mat);\n });\n this._disposeEffectPasses();\n this._noiseTexture.dispose();\n this._voxelRenderer.dispose();\n this._importanceSamplingRenderer.dispose();\n this._voxelTracingPass.dispose();\n this._spatialBlurPass.dispose();\n this._accumulationPass.dispose();\n this._dummyTexture2d.dispose();\n this._dummyTexture3d.dispose();\n this.onNewIblReadyObservable.clear();\n this.onShadowTextureReadyObservable.clear();\n super.dispose();\n }\n}\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,UAAU,QAAQ,4BAA4B;AACjF,SAASC,OAAO,QAAQ,qCAAqC;AAC7D,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,wBAAwB,QAAQ,8BAA8B;AACvE,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,WAAW,QAAQ,oCAAoC;AAChE,SAASC,qCAAqC,QAAQ,2CAA2C;AACjG,SAASC,0BAA0B,QAAQ,gCAAgC;AAC3E,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,yBAAyB,QAAQ,iEAAiE;AAC3G,SAASC,uBAAuB,QAAQ,+DAA+D;AACvG,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,UAAU,QAAQ,wCAAwC;AACnE,SAASC,YAAY,QAAQ,0CAA0C;AACvE,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,eAAe,QAAQ,wCAAwC;AACxE,SAASC,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,UAAU,QAAQ,0BAA0B;AACrD;AACA;AACA;AACA;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