@babylonjs/core 7.33.0 → 7.34.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.
Files changed (124) hide show
  1. package/Cameras/arcRotateCamera.d.ts +14 -0
  2. package/Cameras/arcRotateCamera.js +39 -19
  3. package/Cameras/arcRotateCamera.js.map +1 -1
  4. package/Decorators/nodeDecorator.d.ts +2 -0
  5. package/Decorators/nodeDecorator.js +1 -0
  6. package/Decorators/nodeDecorator.js.map +1 -1
  7. package/Engines/abstractEngine.js +2 -2
  8. package/Engines/abstractEngine.js.map +1 -1
  9. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +63 -0
  10. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +150 -0
  11. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -0
  12. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +3 -47
  13. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +2 -129
  14. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  15. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.d.ts +40 -0
  16. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +98 -0
  17. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +1 -0
  18. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
  19. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  20. package/FrameGraph/Node/Blocks/index.d.ts +3 -2
  21. package/FrameGraph/Node/Blocks/index.js +3 -2
  22. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  23. package/FrameGraph/Passes/renderPass.js +1 -1
  24. package/FrameGraph/Passes/renderPass.js.map +1 -1
  25. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +21 -0
  26. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +110 -0
  27. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -0
  28. package/FrameGraph/frameGraph.d.ts +6 -0
  29. package/FrameGraph/frameGraph.js +15 -1
  30. package/FrameGraph/frameGraph.js.map +1 -1
  31. package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
  32. package/FrameGraph/frameGraphRenderContext.js +9 -4
  33. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  34. package/FrameGraph/frameGraphTask.js +5 -1
  35. package/FrameGraph/frameGraphTask.js.map +1 -1
  36. package/FrameGraph/frameGraphTextureManager.d.ts +8 -0
  37. package/FrameGraph/frameGraphTextureManager.js +51 -7
  38. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  39. package/FrameGraph/frameGraphTypes.d.ts +2 -0
  40. package/FrameGraph/frameGraphTypes.js.map +1 -1
  41. package/FrameGraph/index.d.ts +3 -2
  42. package/FrameGraph/index.js +3 -2
  43. package/FrameGraph/index.js.map +1 -1
  44. package/Layers/layer.d.ts +4 -0
  45. package/Layers/layer.js +13 -2
  46. package/Layers/layer.js.map +1 -1
  47. package/Loading/sceneLoader.d.ts +11 -8
  48. package/Loading/sceneLoader.js +64 -35
  49. package/Loading/sceneLoader.js.map +1 -1
  50. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +2 -0
  51. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -0
  52. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  53. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +6 -1
  54. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +9 -2
  56. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  57. package/Materials/Node/Blocks/GaussianSplatting/index.d.ts +2 -0
  58. package/Materials/Node/Blocks/GaussianSplatting/index.js +3 -0
  59. package/Materials/Node/Blocks/GaussianSplatting/index.js.map +1 -1
  60. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +10 -3
  61. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  62. package/Materials/Node/nodeMaterial.d.ts +1 -1
  63. package/Materials/Node/nodeMaterial.js +1 -1
  64. package/Materials/Node/nodeMaterial.js.map +1 -1
  65. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -0
  66. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +7 -2
  67. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  68. package/Meshes/abstractMesh.hotSpot.js +2 -0
  69. package/Meshes/abstractMesh.hotSpot.js.map +1 -1
  70. package/Meshes/csg2.js +0 -3
  71. package/Meshes/csg2.js.map +1 -1
  72. package/Misc/webRequest.fetch.d.ts +16 -0
  73. package/Misc/webRequest.fetch.js +33 -0
  74. package/Misc/webRequest.fetch.js.map +1 -0
  75. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +2 -0
  76. package/PostProcesses/RenderPipeline/Pipelines/index.js +2 -0
  77. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  78. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +6 -8
  79. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +32 -49
  80. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  81. package/PostProcesses/thinTAAPostProcess.d.ts +72 -0
  82. package/PostProcesses/thinTAAPostProcess.js +149 -0
  83. package/PostProcesses/thinTAAPostProcess.js.map +1 -0
  84. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  85. package/Rendering/IBLShadows/iblShadowsAccumulationPass.d.ts +3 -3
  86. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +7 -7
  87. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  88. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +70 -69
  89. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +102 -112
  90. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  91. package/Rendering/geometryBufferRenderer.js +8 -6
  92. package/Rendering/geometryBufferRenderer.js.map +1 -1
  93. package/Shaders/geometry.vertex.js +1 -1
  94. package/Shaders/geometry.vertex.js.map +1 -1
  95. package/Shaders/layer.fragment.js +3 -1
  96. package/Shaders/layer.fragment.js.map +1 -1
  97. package/Shaders/volumetricLightScattering.fragment.js +1 -1
  98. package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
  99. package/ShadersWGSL/ShadersInclude/gaussianSplatting.d.ts +5 -0
  100. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +47 -0
  101. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -0
  102. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.d.ts +7 -0
  103. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js +20 -0
  104. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js.map +1 -0
  105. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.d.ts +7 -0
  106. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +13 -0
  107. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -0
  108. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.d.ts +5 -0
  109. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +10 -0
  110. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -0
  111. package/ShadersWGSL/gaussianSplatting.fragment.d.ts +10 -0
  112. package/ShadersWGSL/gaussianSplatting.fragment.js +23 -0
  113. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -0
  114. package/ShadersWGSL/gaussianSplatting.vertex.d.ts +14 -0
  115. package/ShadersWGSL/gaussianSplatting.vertex.js +31 -0
  116. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -0
  117. package/ShadersWGSL/geometry.vertex.js +1 -1
  118. package/ShadersWGSL/geometry.vertex.js.map +1 -1
  119. package/ShadersWGSL/layer.fragment.js +4 -2
  120. package/ShadersWGSL/layer.fragment.js.map +1 -1
  121. package/ShadersWGSL/taa.fragment.d.ts +5 -0
  122. package/ShadersWGSL/taa.fragment.js +11 -0
  123. package/ShadersWGSL/taa.fragment.js.map +1 -0
  124. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"iblShadowsAccumulationPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Rendering/IBLShadows/iblShadowsAccumulationPass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,kEAA8D;AAG1F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,2BAA2B;IAmBpC;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAOD;;;OAGG;IACI,cAAc;QACjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAC3B;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAID;;;OAGG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS,CAAC,KAAa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e,EAAE,GAAG,WAAW,CAAC,CAAC;SAClF,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACtH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAEO,gBAAgB;QACpB,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,OAAO,CACH,IAAI,CAAC,oBAAoB;YACzB,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE;YACnC,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC/B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;YAC7B,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CACvD,CAAC;IACN,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;IACL,CAAC;CACJ","sourcesContent":["import { Constants } from \"../../Engines/constants\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { PostProcess } from \"../../PostProcesses/postProcess\";\r\nimport type { PostProcessOptions } from \"../../PostProcesses/postProcess\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { GeometryBufferRenderer } from \"../../Rendering/geometryBufferRenderer\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IProceduralTextureCreationOptions } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IblShadowsRenderPipeline } from \"./iblShadowsRenderPipeline\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * This should not be instanciated directly, as it is part of a scene component\r\n * @internal\r\n */\r\nexport class _IblShadowsAccumulationPass {\r\n private _scene: Scene;\r\n private _engine: AbstractEngine;\r\n private _renderPipeline: IblShadowsRenderPipeline;\r\n\r\n // First, render the accumulation pass with both position buffers, motion buffer, shadow buffer, and the previous accumulation buffer\r\n private _outputTexture: ProceduralTexture;\r\n private _oldAccumulationCopy: ProceduralTexture;\r\n private _oldPositionCopy: ProceduralTexture;\r\n private _accumulationParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /** Enable the debug view for this pass */\r\n public debugEnabled: boolean = false;\r\n\r\n /**\r\n * Is the effect enabled\r\n */\r\n public enabled: boolean = true;\r\n\r\n /**\r\n * Returns the output texture of the pass.\r\n * @returns The output texture.\r\n */\r\n public getOutputTexture(): ProceduralTexture {\r\n return this._outputTexture;\r\n }\r\n\r\n /**\r\n * Observable that triggers when the accumulation texture is ready\r\n */\r\n public onReadyObservable: Observable<void> = new Observable<void>();\r\n\r\n /**\r\n * Gets the debug pass post process\r\n * @returns The post process\r\n */\r\n public getDebugPassPP(): PostProcess {\r\n if (!this._debugPassPP) {\r\n this._createDebugPass();\r\n }\r\n return this._debugPassPP;\r\n }\r\n\r\n private _debugPassName: string = \"Shadow Accumulation Debug Pass\";\r\n\r\n /**\r\n * Gets the name of the debug pass\r\n * @returns The name of the debug pass\r\n */\r\n public get debugPassName(): string {\r\n return this._debugPassName;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public get remenance(): number {\r\n return this._remenance;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public set remenance(value: number) {\r\n this._remenance = value;\r\n }\r\n private _remenance: number = 0.9;\r\n\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public get reset(): boolean {\r\n return this._reset;\r\n }\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public set reset(value: boolean) {\r\n this._reset = value;\r\n }\r\n private _reset: boolean = true;\r\n\r\n /**\r\n * Tell the pass that the camera is moving. This will cause the accumulation\r\n * rate to change.\r\n */\r\n public set isMoving(value: boolean) {\r\n this._isMoving = value;\r\n }\r\n private _isMoving: boolean = false;\r\n\r\n private _debugPassPP: PostProcess;\r\n private _debugSizeParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /**\r\n * Sets params that control the position and scaling of the debug display on the screen.\r\n * @param x Screen X offset of the debug display (0-1)\r\n * @param y Screen Y offset of the debug display (0-1)\r\n * @param widthScale X scale of the debug display (0-1)\r\n * @param heightScale Y scale of the debug display (0-1)\r\n */\r\n public setDebugDisplayParams(x: number, y: number, widthScale: number, heightScale: number) {\r\n this._debugSizeParams.set(x, y, widthScale, heightScale);\r\n }\r\n\r\n /**\r\n * Creates the debug post process effect for this pass\r\n */\r\n private _createDebugPass() {\r\n if (!this._debugPassPP) {\r\n const isWebGPU = this._engine.isWebGPU;\r\n const debugOptions: PostProcessOptions = {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n textureFormat: Constants.TEXTUREFORMAT_RGBA,\r\n textureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n uniforms: [\"sizeParams\"],\r\n samplers: [\"debugSampler\"],\r\n engine: this._engine,\r\n reusable: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializations: (useWebGPU: boolean, list: Promise<any>[]) => {\r\n if (useWebGPU) {\r\n list.push(import(\"../../ShadersWGSL/iblShadowDebug.fragment\"));\r\n } else {\r\n list.push(import(\"../../Shaders/iblShadowDebug.fragment\"));\r\n }\r\n },\r\n };\r\n this._debugPassPP = new PostProcess(this.debugPassName, \"iblShadowDebug\", debugOptions);\r\n this._debugPassPP.autoClear = false;\r\n this._debugPassPP.onApplyObservable.add((effect) => {\r\n // update the caustic texture with what we just rendered.\r\n effect.setTexture(\"debugSampler\", this._outputTexture);\r\n effect.setVector4(\"sizeParams\", this._debugSizeParams);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates the accumulation pass\r\n * @param scene Scene to attach to\r\n * @param iblShadowsRenderPipeline The IBL shadows render pipeline\r\n * @returns The accumulation pass\r\n */\r\n constructor(scene: Scene, iblShadowsRenderPipeline: IblShadowsRenderPipeline) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._renderPipeline = iblShadowsRenderPipeline;\r\n this._createTextures();\r\n }\r\n\r\n private _createTextures() {\r\n const isWebGPU = this._engine.isWebGPU;\r\n\r\n const outputTextureOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/iblShadowAccumulation.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/iblShadowAccumulation.fragment\")]);\r\n }\r\n },\r\n };\r\n this._outputTexture = new ProceduralTexture(\r\n \"shadowAccumulationPass\",\r\n {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n },\r\n \"iblShadowAccumulation\",\r\n this._scene,\r\n outputTextureOptions\r\n );\r\n this._outputTexture.refreshRate = -1;\r\n this._outputTexture.autoClear = false;\r\n this._outputTexture.onGeneratedObservable.addOnce(() => {\r\n this.onReadyObservable.notifyObservers();\r\n });\r\n\r\n // Need to set all the textures first so that the effect gets created with the proper uniforms.\r\n this._setOutputTextureBindings();\r\n\r\n let counter = 0;\r\n this._scene.onBeforeRenderObservable.add(() => {\r\n counter = 0;\r\n });\r\n this._scene.onAfterRenderTargetsRenderObservable.add(() => {\r\n if (++counter == 2) {\r\n if (this.enabled && this._outputTexture.isReady()) {\r\n this._setOutputTextureBindings();\r\n this._outputTexture.render();\r\n }\r\n }\r\n });\r\n\r\n // Create the accumulation texture for the previous frame.\r\n // We'll copy the output of the accumulation pass to this texture at the start of every frame.\r\n const accumulationOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldAccumulationCopy = new ProceduralTexture(\r\n \"oldAccumulationRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n accumulationOptions,\r\n false\r\n );\r\n\r\n this._oldAccumulationCopy.autoClear = false;\r\n this._oldAccumulationCopy.refreshRate = 1;\r\n this._oldAccumulationCopy.onBeforeGenerationObservable.add(this._setAccumulationCopyBindings.bind(this));\r\n this._setAccumulationCopyBindings();\r\n\r\n // Create the local position texture for the previous frame.\r\n // We'll copy the previous local position texture to this texture at the start of every frame.\r\n const localPositionOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldPositionCopy = new ProceduralTexture(\r\n \"oldLocalPositionRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n localPositionOptions,\r\n false\r\n );\r\n this._updatePositionCopy();\r\n this._oldPositionCopy.autoClear = false;\r\n this._oldPositionCopy.refreshRate = 1;\r\n this._oldPositionCopy.onBeforeGenerationObservable.add(this._updatePositionCopy.bind(this));\r\n }\r\n\r\n private _setOutputTextureBindings() {\r\n const remenance = this._isMoving ? this.remenance : 0.99;\r\n this._accumulationParams.set(remenance, this.reset ? 1.0 : 0.0, this._renderPipeline.voxelGridSize, 0.0);\r\n this._outputTexture.setTexture(\"spatialBlurSampler\", this._renderPipeline._getSpatialBlurTexture());\r\n this._outputTexture.setVector4(\"accumulationParameters\", this._accumulationParams);\r\n this._outputTexture.setTexture(\"oldAccumulationSampler\", this._oldAccumulationCopy ? this._oldAccumulationCopy : this._renderPipeline._dummyTexture2d);\r\n this._outputTexture.setTexture(\"prevPositionSampler\", this._oldPositionCopy ? this._oldPositionCopy : this._renderPipeline._dummyTexture2d);\r\n\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n if (!geometryBufferRenderer) {\r\n return;\r\n }\r\n const velocityIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"motionSampler\", geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\r\n const wPositionIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"positionSampler\", geometryBufferRenderer.getGBuffer().textures[wPositionIndex]);\r\n\r\n this.reset = false;\r\n this._isMoving = false;\r\n }\r\n\r\n private _updatePositionCopy() {\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n const index = geometryBufferRenderer!.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._oldPositionCopy.setTexture(\"textureSampler\", geometryBufferRenderer!.getGBuffer().textures[index]);\r\n }\r\n\r\n private _setAccumulationCopyBindings() {\r\n this._oldAccumulationCopy.setTexture(\"textureSampler\", this._outputTexture);\r\n }\r\n\r\n /**\r\n * Called by render pipeline when canvas resized.\r\n * @param scaleFactor The factor by which to scale the canvas size.\r\n */\r\n public resize(scaleFactor: number = 1.0) {\r\n const newSize = {\r\n width: Math.max(1.0, Math.floor(this._engine.getRenderWidth() * scaleFactor)),\r\n height: Math.max(1.0, Math.floor(this._engine.getRenderHeight() * scaleFactor)),\r\n };\r\n this._outputTexture.resize(newSize, false);\r\n this._oldAccumulationCopy.resize(newSize, false);\r\n this._oldPositionCopy.resize({ width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, false);\r\n this.reset = true;\r\n }\r\n\r\n private _disposeTextures() {\r\n this._oldAccumulationCopy.dispose();\r\n this._oldPositionCopy.dispose();\r\n this._outputTexture.dispose();\r\n }\r\n\r\n /**\r\n * Checks if the pass is ready\r\n * @returns true if the pass is ready\r\n */\r\n public isReady() {\r\n return (\r\n this._oldAccumulationCopy &&\r\n this._oldAccumulationCopy.isReady() &&\r\n this._oldPositionCopy &&\r\n this._oldPositionCopy.isReady() &&\r\n this._outputTexture.isReady() &&\r\n !(this._debugPassPP && !this._debugPassPP.isReady())\r\n );\r\n }\r\n\r\n /**\r\n * Disposes the associated resources\r\n */\r\n public dispose() {\r\n this._disposeTextures();\r\n if (this._debugPassPP) {\r\n this._debugPassPP.dispose();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"iblShadowsAccumulationPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/Rendering/IBLShadows/iblShadowsAccumulationPass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,kEAA8D;AAG1F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,2BAA2B;IAmBpC;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAOD;;;OAGG;IACI,cAAc;QACjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAC3B;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAID;;;OAGG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS,CAAC,KAAa;QAC9B,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GAAG,WAAW,CAAC,CAAC;SAClF,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACtH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAEO,gBAAgB;QACpB,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,OAAO,CACH,IAAI,CAAC,oBAAoB;YACzB,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE;YACnC,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC/B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;YAC7B,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CACvD,CAAC;IACN,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;IACL,CAAC;CACJ","sourcesContent":["import { Constants } from \"../../Engines/constants\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { PostProcess } from \"../../PostProcesses/postProcess\";\r\nimport type { PostProcessOptions } from \"../../PostProcesses/postProcess\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { GeometryBufferRenderer } from \"../../Rendering/geometryBufferRenderer\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IProceduralTextureCreationOptions } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { IblShadowsRenderPipeline } from \"./iblShadowsRenderPipeline\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * This should not be instanciated directly, as it is part of a scene component\r\n * @internal\r\n */\r\nexport class _IblShadowsAccumulationPass {\r\n private _scene: Scene;\r\n private _engine: AbstractEngine;\r\n private _renderPipeline: IblShadowsRenderPipeline;\r\n\r\n // First, render the accumulation pass with both position buffers, motion buffer, shadow buffer, and the previous accumulation buffer\r\n private _outputTexture: ProceduralTexture;\r\n private _oldAccumulationCopy: ProceduralTexture;\r\n private _oldPositionCopy: ProceduralTexture;\r\n private _accumulationParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /** Enable the debug view for this pass */\r\n public debugEnabled: boolean = false;\r\n\r\n /**\r\n * Is the effect enabled\r\n */\r\n public enabled: boolean = true;\r\n\r\n /**\r\n * Returns the output texture of the pass.\r\n * @returns The output texture.\r\n */\r\n public getOutputTexture(): ProceduralTexture {\r\n return this._outputTexture;\r\n }\r\n\r\n /**\r\n * Observable that triggers when the accumulation texture is ready\r\n */\r\n public onReadyObservable: Observable<void> = new Observable<void>();\r\n\r\n /**\r\n * Gets the debug pass post process\r\n * @returns The post process\r\n */\r\n public getDebugPassPP(): PostProcess {\r\n if (!this._debugPassPP) {\r\n this._createDebugPass();\r\n }\r\n return this._debugPassPP;\r\n }\r\n\r\n private _debugPassName: string = \"Shadow Accumulation Debug Pass\";\r\n\r\n /**\r\n * Gets the name of the debug pass\r\n * @returns The name of the debug pass\r\n */\r\n public get debugPassName(): string {\r\n return this._debugPassName;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public get remanence(): number {\r\n return this._remanence;\r\n }\r\n\r\n /**\r\n * A value that controls how much of the previous frame's accumulation to keep.\r\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\r\n */\r\n public set remanence(value: number) {\r\n this._remanence = value;\r\n }\r\n private _remanence: number = 0.9;\r\n\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public get reset(): boolean {\r\n return this._reset;\r\n }\r\n /**\r\n * Reset the accumulation.\r\n */\r\n public set reset(value: boolean) {\r\n this._reset = value;\r\n }\r\n private _reset: boolean = true;\r\n\r\n /**\r\n * Tell the pass that the camera is moving. This will cause the accumulation\r\n * rate to change.\r\n */\r\n public set isMoving(value: boolean) {\r\n this._isMoving = value;\r\n }\r\n private _isMoving: boolean = false;\r\n\r\n private _debugPassPP: PostProcess;\r\n private _debugSizeParams: Vector4 = new Vector4(0.0, 0.0, 0.0, 0.0);\r\n\r\n /**\r\n * Sets params that control the position and scaling of the debug display on the screen.\r\n * @param x Screen X offset of the debug display (0-1)\r\n * @param y Screen Y offset of the debug display (0-1)\r\n * @param widthScale X scale of the debug display (0-1)\r\n * @param heightScale Y scale of the debug display (0-1)\r\n */\r\n public setDebugDisplayParams(x: number, y: number, widthScale: number, heightScale: number) {\r\n this._debugSizeParams.set(x, y, widthScale, heightScale);\r\n }\r\n\r\n /**\r\n * Creates the debug post process effect for this pass\r\n */\r\n private _createDebugPass() {\r\n if (!this._debugPassPP) {\r\n const isWebGPU = this._engine.isWebGPU;\r\n const debugOptions: PostProcessOptions = {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n textureFormat: Constants.TEXTUREFORMAT_RGBA,\r\n textureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n uniforms: [\"sizeParams\"],\r\n samplers: [\"debugSampler\"],\r\n engine: this._engine,\r\n reusable: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializations: (useWebGPU: boolean, list: Promise<any>[]) => {\r\n if (useWebGPU) {\r\n list.push(import(\"../../ShadersWGSL/iblShadowDebug.fragment\"));\r\n } else {\r\n list.push(import(\"../../Shaders/iblShadowDebug.fragment\"));\r\n }\r\n },\r\n };\r\n this._debugPassPP = new PostProcess(this.debugPassName, \"iblShadowDebug\", debugOptions);\r\n this._debugPassPP.autoClear = false;\r\n this._debugPassPP.onApplyObservable.add((effect) => {\r\n // update the caustic texture with what we just rendered.\r\n effect.setTexture(\"debugSampler\", this._outputTexture);\r\n effect.setVector4(\"sizeParams\", this._debugSizeParams);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates the accumulation pass\r\n * @param scene Scene to attach to\r\n * @param iblShadowsRenderPipeline The IBL shadows render pipeline\r\n * @returns The accumulation pass\r\n */\r\n constructor(scene: Scene, iblShadowsRenderPipeline: IblShadowsRenderPipeline) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._renderPipeline = iblShadowsRenderPipeline;\r\n this._createTextures();\r\n }\r\n\r\n private _createTextures() {\r\n const isWebGPU = this._engine.isWebGPU;\r\n\r\n const outputTextureOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/iblShadowAccumulation.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/iblShadowAccumulation.fragment\")]);\r\n }\r\n },\r\n };\r\n this._outputTexture = new ProceduralTexture(\r\n \"shadowAccumulationPass\",\r\n {\r\n width: this._engine.getRenderWidth(),\r\n height: this._engine.getRenderHeight(),\r\n },\r\n \"iblShadowAccumulation\",\r\n this._scene,\r\n outputTextureOptions\r\n );\r\n this._outputTexture.refreshRate = -1;\r\n this._outputTexture.autoClear = false;\r\n this._outputTexture.onGeneratedObservable.addOnce(() => {\r\n this.onReadyObservable.notifyObservers();\r\n });\r\n\r\n // Need to set all the textures first so that the effect gets created with the proper uniforms.\r\n this._setOutputTextureBindings();\r\n\r\n let counter = 0;\r\n this._scene.onBeforeRenderObservable.add(() => {\r\n counter = 0;\r\n });\r\n this._scene.onAfterRenderTargetsRenderObservable.add(() => {\r\n if (++counter == 2) {\r\n if (this.enabled && this._outputTexture.isReady()) {\r\n this._setOutputTextureBindings();\r\n this._outputTexture.render();\r\n }\r\n }\r\n });\r\n\r\n // Create the accumulation texture for the previous frame.\r\n // We'll copy the output of the accumulation pass to this texture at the start of every frame.\r\n const accumulationOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldAccumulationCopy = new ProceduralTexture(\r\n \"oldAccumulationRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n accumulationOptions,\r\n false\r\n );\r\n\r\n this._oldAccumulationCopy.autoClear = false;\r\n this._oldAccumulationCopy.refreshRate = 1;\r\n this._oldAccumulationCopy.onBeforeGenerationObservable.add(this._setAccumulationCopyBindings.bind(this));\r\n this._setAccumulationCopyBindings();\r\n\r\n // Create the local position texture for the previous frame.\r\n // We'll copy the previous local position texture to this texture at the start of every frame.\r\n const localPositionOptions: IProceduralTextureCreationOptions = {\r\n type: Constants.TEXTURETYPE_HALF_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/pass.fragment\")]);\r\n }\r\n },\r\n };\r\n\r\n this._oldPositionCopy = new ProceduralTexture(\r\n \"oldLocalPositionRT\",\r\n { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() },\r\n \"pass\",\r\n this._scene,\r\n localPositionOptions,\r\n false\r\n );\r\n this._updatePositionCopy();\r\n this._oldPositionCopy.autoClear = false;\r\n this._oldPositionCopy.refreshRate = 1;\r\n this._oldPositionCopy.onBeforeGenerationObservable.add(this._updatePositionCopy.bind(this));\r\n }\r\n\r\n private _setOutputTextureBindings() {\r\n const remanence = this._isMoving ? this.remanence : 0.99;\r\n this._accumulationParams.set(remanence, this.reset ? 1.0 : 0.0, this._renderPipeline.voxelGridSize, 0.0);\r\n this._outputTexture.setTexture(\"spatialBlurSampler\", this._renderPipeline._getSpatialBlurTexture());\r\n this._outputTexture.setVector4(\"accumulationParameters\", this._accumulationParams);\r\n this._outputTexture.setTexture(\"oldAccumulationSampler\", this._oldAccumulationCopy ? this._oldAccumulationCopy : this._renderPipeline._dummyTexture2d);\r\n this._outputTexture.setTexture(\"prevPositionSampler\", this._oldPositionCopy ? this._oldPositionCopy : this._renderPipeline._dummyTexture2d);\r\n\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n if (!geometryBufferRenderer) {\r\n return;\r\n }\r\n const velocityIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"motionSampler\", geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\r\n const wPositionIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._outputTexture.setTexture(\"positionSampler\", geometryBufferRenderer.getGBuffer().textures[wPositionIndex]);\r\n\r\n this.reset = false;\r\n this._isMoving = false;\r\n }\r\n\r\n private _updatePositionCopy() {\r\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\r\n const index = geometryBufferRenderer!.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\r\n this._oldPositionCopy.setTexture(\"textureSampler\", geometryBufferRenderer!.getGBuffer().textures[index]);\r\n }\r\n\r\n private _setAccumulationCopyBindings() {\r\n this._oldAccumulationCopy.setTexture(\"textureSampler\", this._outputTexture);\r\n }\r\n\r\n /**\r\n * Called by render pipeline when canvas resized.\r\n * @param scaleFactor The factor by which to scale the canvas size.\r\n */\r\n public resize(scaleFactor: number = 1.0) {\r\n const newSize = {\r\n width: Math.max(1.0, Math.floor(this._engine.getRenderWidth() * scaleFactor)),\r\n height: Math.max(1.0, Math.floor(this._engine.getRenderHeight() * scaleFactor)),\r\n };\r\n this._outputTexture.resize(newSize, false);\r\n this._oldAccumulationCopy.resize(newSize, false);\r\n this._oldPositionCopy.resize({ width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, false);\r\n this.reset = true;\r\n }\r\n\r\n private _disposeTextures() {\r\n this._oldAccumulationCopy.dispose();\r\n this._oldPositionCopy.dispose();\r\n this._outputTexture.dispose();\r\n }\r\n\r\n /**\r\n * Checks if the pass is ready\r\n * @returns true if the pass is ready\r\n */\r\n public isReady() {\r\n return (\r\n this._oldAccumulationCopy &&\r\n this._oldAccumulationCopy.isReady() &&\r\n this._oldPositionCopy &&\r\n this._oldPositionCopy.isReady() &&\r\n this._outputTexture.isReady() &&\r\n !(this._debugPassPP && !this._debugPassPP.isReady())\r\n );\r\n }\r\n\r\n /**\r\n * Disposes the associated resources\r\n */\r\n public dispose() {\r\n this._disposeTextures();\r\n if (this._debugPassPP) {\r\n this._debugPassPP.dispose();\r\n }\r\n }\r\n}\r\n"]}
@@ -24,17 +24,25 @@ interface IblShadowsSettings {
24
24
  */
25
25
  shadowOpacity?: number;
26
26
  /**
27
- * How long the shadows remain in the scene. 0.0 is no persistence, 1.0 is full persistence.
27
+ * 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.
28
28
  */
29
- shadowRemenance?: number;
29
+ envRotation?: number;
30
+ /**
31
+ * A factor that controls how long the shadows remain in the scene.
32
+ * 0.0 is no persistence, 1.0 is full persistence.
33
+ * This value applies only while the camera is moving. Once stationary, the pipeline
34
+ * increases remanence automatically to help the shadows converge.
35
+ */
36
+ shadowRemanence?: number;
30
37
  /**
31
38
  * Render the voxel grid from 3 different axis. This will result in better quality shadows with fewer
32
39
  * bits of missing geometry.
33
40
  */
34
41
  triPlanarVoxelization?: boolean;
35
42
  /**
36
- * A multiplier for the render size of the shadows. Used for rendering lower-resolution shadows
37
- * to increase performance. Should be a value between 0 and 1.
43
+ * A size multiplier for the internal shadow render targets (default 1.0). A value of 1.0 represents full-resolution.
44
+ * Scaling this below 1.0 will result in blurry shadows and potentially more artifacts but
45
+ * could help increase performance on less powerful GPU's.
38
46
  */
39
47
  shadowRenderSizeFactor?: number;
40
48
  /**
@@ -51,16 +59,20 @@ interface IblShadowsSettings {
51
59
  */
52
60
  ssShadowSampleCount?: number;
53
61
  /**
54
- * The stride of the screen-space shadow pass. This controls the distance between samples.
62
+ * The stride of the screen-space shadow pass. This controls the distance between samples
63
+ * in pixels.
55
64
  */
56
65
  ssShadowStride?: number;
57
66
  /**
58
- * The maximum distance a shadow can be cast in screen space. This should usually be kept small
59
- * as screenspace shadows are mostly useful for small details.
67
+ * A scale for the maximum distance a screen-space shadow can be cast in world-space.
68
+ * The maximum distance that screen-space shadows cast is derived from the voxel size
69
+ * and this value so shouldn't need to change if you scale your scene.
60
70
  */
61
71
  ssShadowDistanceScale?: number;
62
72
  /**
63
- * Screen-space shadow thickness. This value controls the perceived thickness of the SS shadows.
73
+ * Screen-space shadow thickness scale. This value controls the assumed thickness of
74
+ * on-screen surfaces in world-space. It scales with the size of the shadow-casting
75
+ * region so shouldn't need to change if you scale your scene.
64
76
  */
65
77
  ssShadowThicknessScale?: number;
66
78
  }
@@ -105,7 +117,8 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
105
117
  */
106
118
  voxelGridSize: number;
107
119
  /**
108
- * Reset the shadow accumulation.
120
+ * Reset the shadow accumulation. This has a similar affect to lowering the remanence for a single frame.
121
+ * This is useful when making a sudden change to the IBL.
109
122
  */
110
123
  resetAccumulation(): void;
111
124
  /**
@@ -132,23 +145,27 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
132
145
  /**
133
146
  * The number of samples used in the screen space shadow pass.
134
147
  */
135
- get ssShadowSamples(): number;
136
- set ssShadowSamples(value: number);
148
+ get ssShadowSampleCount(): number;
149
+ set ssShadowSampleCount(value: number);
137
150
  /**
138
- * The stride of the screen-space shadow pass. This controls the distance between samples.
151
+ * The stride of the screen-space shadow pass. This controls the distance between samples
152
+ * in pixels.
139
153
  */
140
154
  get ssShadowStride(): number;
141
155
  set ssShadowStride(value: number);
142
156
  private _sssMaxDistScale;
143
157
  /**
144
- * A scale for the maximum distance a shadow can be cast in screen space.
145
- * The absolute distance for SS shadows is derived from the voxel size and this scalar.
158
+ * A scale for the maximum distance a screen-space shadow can be cast in world-space.
159
+ * The maximum distance that screen-space shadows cast is derived from the voxel size
160
+ * and this value so shouldn't need to change if you scale your scene
146
161
  */
147
162
  get ssShadowDistanceScale(): number;
148
163
  set ssShadowDistanceScale(value: number);
149
164
  private _sssThicknessScale;
150
165
  /**
151
- * Screen-space shadow thickness. This value controls the perceived thickness of the SS shadows.
166
+ * Screen-space shadow thickness scale. This value controls the assumed thickness of
167
+ * on-screen surfaces in world-space. It scales with the size of the shadow-casting
168
+ * region so shouldn't need to change if you scale your scene.
152
169
  */
153
170
  get ssShadowThicknessScale(): number;
154
171
  set ssShadowThicknessScale(value: number);
@@ -204,12 +221,10 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
204
221
  private _gbufferDebugEnabled;
205
222
  private _gBufferDebugSizeParams;
206
223
  /**
207
- * Is the debug view of the G-Buffer enabled?
224
+ * Turn on or off the debug view of the G-Buffer. This will display only the targets
225
+ * of the g-buffer that are used by the shadow pipeline.
208
226
  */
209
227
  get gbufferDebugEnabled(): boolean;
210
- /**
211
- * Turn on or off the debug view of the G-Buffer
212
- */
213
228
  set gbufferDebugEnabled(enabled: boolean);
214
229
  /**
215
230
  * Turn on or off the debug view of the CDF importance sampling data
@@ -220,58 +235,48 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
220
235
  */
221
236
  set importanceSamplingDebugEnabled(enabled: boolean);
222
237
  /**
223
- * Turn on or off the debug view of the voxel grid
238
+ * This displays the voxel grid in slices spread across the screen.
239
+ * It also displays what slices of the model are stored in each layer
240
+ * of the voxel grid. Each red stripe represents one layer while each gradient
241
+ * (from bright red to black) represents the layers rendered in a single draw call.
224
242
  */
225
243
  get voxelDebugEnabled(): boolean;
226
- /**
227
- * Turn on or off the debug view of the voxel grid
228
- */
229
244
  set voxelDebugEnabled(enabled: boolean);
230
245
  /**
231
- * Set the axis to display for the voxel grid debug view
232
- * When using tri-axis voxelization, this will display the voxel grid for the specified axis
246
+ * When using tri-planar voxelization (the default), this value can be used to
247
+ * display only the voxelization result for that axis. z-axis = 0, y-axis = 1, x-axis = 2
233
248
  */
234
249
  get voxelDebugAxis(): number;
235
- /**
236
- * Set the axis to display for the voxel grid debug view
237
- * When using tri-axis voxelization, this will display the voxel grid for the specified axis
238
- */
239
250
  set voxelDebugAxis(axisNum: number);
240
251
  /**
241
- * Set the mip level to display for the voxel grid debug view
252
+ * Displays a given mip of the voxel grid. `voxelDebugAxis` must be undefined in this
253
+ * case because we only generate mips for the combined voxel grid.
242
254
  */
243
255
  set voxelDebugDisplayMip(mipNum: number);
244
256
  /**
245
- * Display the debug view for the voxel tracing pass
257
+ * Display the debug view for just the shadow samples taken this frame.
246
258
  */
247
259
  get voxelTracingDebugEnabled(): boolean;
248
- /**
249
- * Display the debug view for the voxel tracing pass
250
- */
251
260
  set voxelTracingDebugEnabled(enabled: boolean);
252
261
  /**
253
262
  * Display the debug view for the spatial blur pass
254
263
  */
255
264
  get spatialBlurPassDebugEnabled(): boolean;
256
- /**
257
- * Display the debug view for the spatial blur pass
258
- */
259
265
  set spatialBlurPassDebugEnabled(enabled: boolean);
260
266
  /**
261
- * Display the debug view for the accumulation pass
267
+ * Display the debug view for the shadows accumulated over time.
262
268
  */
263
269
  get accumulationPassDebugEnabled(): boolean;
264
- /**
265
- * Display the debug view for the accumulation pass
266
- */
267
270
  set accumulationPassDebugEnabled(enabled: boolean);
268
271
  /**
269
- * Add a mesh to be used for shadow casting in the IBL shadow pipeline
272
+ * Add a mesh to be used for shadow-casting in the IBL shadow pipeline.
273
+ * These meshes will be written to the voxel grid.
270
274
  * @param mesh A mesh or list of meshes that you want to cast shadows
271
275
  */
272
276
  addShadowCastingMesh(mesh: Mesh | Mesh[]): void;
273
277
  /**
274
- * Remove a mesh from the shadow-casting list.
278
+ * Remove a mesh from the shadow-casting list. The mesh will no longer be written
279
+ * to the voxel grid and will not cast shadows.
275
280
  * @param mesh The mesh or list of meshes that you don't want to cast shadows.
276
281
  */
277
282
  removeShadowCastingMesh(mesh: Mesh | Mesh[]): void;
@@ -281,11 +286,6 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
281
286
  * The resolution is calculated as 2 to the power of this number.
282
287
  */
283
288
  get resolutionExp(): number;
284
- /**
285
- * The exponent of the resolution of the voxel shadow grid. Higher resolutions will result in sharper
286
- * shadows but are more expensive to compute and require more memory.
287
- * The resolution is calculated as 2 to the power of this number.
288
- */
289
289
  set resolutionExp(newResolution: number);
290
290
  /**
291
291
  * The number of different directions to sample during the voxel tracing pass
@@ -298,17 +298,17 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
298
298
  /**
299
299
  * The decree to which the shadows persist between frames. 0.0 is no persistence, 1.0 is full persistence.
300
300
  **/
301
- get shadowRemenance(): number;
301
+ get shadowRemanence(): number;
302
302
  /**
303
303
  * The decree to which the shadows persist between frames. 0.0 is no persistence, 1.0 is full persistence.
304
304
  **/
305
- set shadowRemenance(value: number);
305
+ set shadowRemanence(value: number);
306
306
  /**
307
- * The global rotation of the IBL for shadows
307
+ * 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.
308
308
  */
309
309
  get envRotation(): number;
310
310
  /**
311
- * The global rotation of the IBL for shadows
311
+ * 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.
312
312
  */
313
313
  set envRotation(value: number);
314
314
  /**
@@ -323,6 +323,19 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
323
323
  * Support test.
324
324
  */
325
325
  static get IsSupported(): boolean;
326
+ /**
327
+ * Toggle the shadow tracing on or off
328
+ * @param enabled Toggle the shadow tracing on or off
329
+ */
330
+ toggleShadow(enabled: boolean): void;
331
+ /**
332
+ * Trigger the scene to be re-voxelized. This should be run when any shadow-casters have been added, removed or moved.
333
+ */
334
+ updateVoxelization(): void;
335
+ /**
336
+ * 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.
337
+ */
338
+ updateSceneBounds(): void;
326
339
  /**
327
340
  * @param name The rendering pipeline name
328
341
  * @param scene The scene linked to this pipeline
@@ -330,39 +343,27 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
330
343
  * @param cameras Cameras to apply the pipeline to.
331
344
  */
332
345
  constructor(name: string, scene: Scene, options?: Partial<IblShadowsSettings>, cameras?: Camera[]);
333
- /**
334
- * Toggle the shadow tracing on or off
335
- * @param enabled Toggle the shadow tracing on or off
336
- */
337
- toggleShadow(enabled: boolean): void;
338
346
  private _handleResize;
339
347
  private _getGBufferDebugPass;
340
348
  private _createDebugPasses;
341
349
  private _disposeEffectPasses;
342
350
  private _disposeDebugPasses;
343
351
  private _updateDebugPasses;
344
- /**
345
- * Trigger the scene to be re-voxelized. This is useful when the scene has changed and the voxel grid needs to be updated.
346
- */
347
- updateVoxelization(): void;
348
- /**
349
- * Trigger the scene bounds of shadow-casters to be updated. This is useful when the scene has changed and the bounds need
350
- * to be recalculated. This will also trigger a re-voxelization.
351
- */
352
- updateSceneBounds(): void;
353
352
  /**
354
353
  * Update the SS shadow max distance and thickness based on the voxel grid size and resolution.
355
354
  * The max distance should be just a little larger than the world size of a single voxel.
356
355
  */
357
356
  private _updateSSShadowParams;
358
357
  /**
359
- * Apply the shadows to a material or array of materials.
358
+ * Apply the shadows to a material or array of materials. If no material is provided, all
359
+ * materials in the scene will be added.
360
360
  * @param material Material that will be affected by the shadows. If not provided, all materials of the scene will be affected.
361
361
  */
362
362
  addShadowReceivingMaterial(material?: Material | Material[]): void;
363
363
  /**
364
- * Remove a material from receiving shadows
365
- * @param material The material that will no longer receive shadows
364
+ * Remove a material from the list of materials that receive shadows. If no material
365
+ * is provided, all materials in the scene will be removed.
366
+ * @param material The material or array of materials that will no longer receive shadows
366
367
  */
367
368
  removeShadowReceivingMaterial(material: Material | Material[]): void;
368
369
  protected _addShadowSupportToMaterial(material: Material): void;