@onerjs/core 8.55.8 → 8.56.1
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.
- package/Animations/animation.pure.js +2 -2
- package/Animations/animation.pure.js.map +1 -1
- package/Animations/runtimeAnimation.js +4 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.d.ts +7 -0
- package/AudioV2/webAudio/webAudioEngine.js +6 -5
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Meshes/followBehavior.js +1 -0
- package/Behaviors/Meshes/followBehavior.js.map +1 -1
- package/Behaviors/Meshes/surfaceMagnetismBehavior.js +1 -0
- package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.js +2 -2
- package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/followCameraPointersInput.d.ts +15 -0
- package/Cameras/Inputs/followCameraPointersInput.js +18 -3
- package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.js +1 -1
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +1 -0
- package/Collisions/gpuPicker.js +5 -4
- package/Collisions/gpuPicker.js.map +1 -1
- package/Culling/Helper/boundingInfoHelper.js +9 -5
- package/Culling/Helper/boundingInfoHelper.js.map +1 -1
- package/Culling/boundingSphere.js +7 -4
- package/Culling/boundingSphere.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.d.ts +5 -1
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.js +7 -3
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.d.ts +6 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js +16 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js.map +1 -0
- package/Engines/AbstractEngine/pure.d.ts +1 -0
- package/Engines/AbstractEngine/pure.js +1 -0
- package/Engines/AbstractEngine/pure.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
- package/Engines/IDrawContext.d.ts +2 -0
- package/Engines/IDrawContext.js.map +1 -1
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +48 -6
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +1 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
- package/Engines/WebGPU/webgpuDrawContext.js +15 -0
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.d.ts +21 -4
- package/Engines/thinNativeEngine.pure.d.ts +6 -1
- package/Engines/thinNativeEngine.pure.js +29 -2
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -0
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +10 -0
- package/Engines/webgpuEngine.pure.js +15 -1
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.d.ts +3 -63
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js +5 -71
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.d.ts +71 -0
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js +86 -0
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Data/pure.d.ts +1 -0
- package/FlowGraph/Blocks/Data/pure.js +1 -0
- package/FlowGraph/Blocks/Data/pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.d.ts +3 -37
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js +5 -39
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.d.ts +45 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js +54 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.d.ts +3 -17
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js +5 -22
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.d.ts +25 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js +37 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Event/pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/pure.js +2 -0
- package/FlowGraph/Blocks/Event/pure.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +198 -172
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +2 -5
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
- package/FrameGraph/frameGraph.js +10 -1
- package/FrameGraph/frameGraph.js.map +1 -1
- package/Gamepads/gamepadManager.d.ts +1 -0
- package/Gamepads/gamepadManager.js +5 -2
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gizmos/scaleGizmo.js +1 -0
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Lights/IES/iesLoader.js +6 -8
- package/Lights/IES/iesLoader.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.pure.js +4 -6
- package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +2 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/light.js +3 -5
- package/Lights/light.js.map +1 -1
- package/Lights/spotLight.pure.js +1 -1
- package/Lights/spotLight.pure.js.map +1 -1
- package/Materials/Background/backgroundMaterial.pure.d.ts +1 -1
- package/Materials/Background/backgroundMaterial.pure.js +3 -12
- package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js +2 -0
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +1 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/powBlock.pure.js +2 -1
- package/Materials/Node/Blocks/powBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.pure.js +14 -12
- package/Materials/Node/Blocks/triPlanarBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.d.ts +1 -0
- package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
- package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -1
- package/Materials/PBR/openpbrMaterial.pure.js +3 -12
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -1
- package/Materials/PBR/pbrBaseMaterial.pure.js +3 -12
- package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -0
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.pure.js +1 -1
- package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
- package/Materials/drawWrapper.js +3 -0
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/imageProcessingConfiguration.defines.d.ts +3 -0
- package/Materials/imageProcessingConfiguration.defines.js +2 -0
- package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
- package/Materials/imageProcessingConfiguration.functions.js +3 -0
- package/Materials/imageProcessingConfiguration.functions.js.map +1 -1
- package/Materials/imageProcessingConfiguration.pure.d.ts +58 -0
- package/Materials/imageProcessingConfiguration.pure.js +123 -2
- package/Materials/imageProcessingConfiguration.pure.js.map +1 -1
- package/Materials/material.pure.js +2 -2
- package/Materials/material.pure.js.map +1 -1
- package/Materials/standardMaterial.pure.d.ts +2 -1
- package/Materials/standardMaterial.pure.js +4 -13
- package/Materials/standardMaterial.pure.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +29 -0
- package/Materials/uniformBuffer.js +146 -0
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/colorTemperature.functions.d.ts +29 -0
- package/Maths/colorTemperature.functions.js +196 -0
- package/Maths/colorTemperature.functions.js.map +1 -0
- package/Maths/index.d.ts +1 -0
- package/Maths/index.js +1 -0
- package/Maths/index.js.map +1 -1
- package/Maths/math.path.js +1 -1
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.polar.js +1 -1
- package/Maths/math.polar.js.map +1 -1
- package/Maths/math.vector.pure.js +4 -3
- package/Maths/math.vector.pure.js.map +1 -1
- package/Maths/pure.d.ts +1 -0
- package/Maths/pure.js +1 -0
- package/Maths/pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +72 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +164 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +36 -18
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +5 -4
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +25 -8
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +3 -3
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js +2 -2
- package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.pure.js +2 -2
- package/Meshes/Node/Blocks/mappingBlock.pure.js.map +1 -1
- package/Meshes/csg.js +5 -5
- package/Meshes/csg.js.map +1 -1
- package/Meshes/groundMesh.pure.js +1 -1
- package/Meshes/groundMesh.pure.js.map +1 -1
- package/Meshes/mesh.pure.js +2 -2
- package/Meshes/mesh.pure.js.map +1 -1
- package/Misc/deepMerger.js +1 -1
- package/Misc/deepMerger.js.map +1 -1
- package/Misc/dumpTools.pure.js +1 -1
- package/Misc/dumpTools.pure.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/observable.pure.js +1 -3
- package/Misc/observable.pure.js.map +1 -1
- package/Misc/pure.d.ts +1 -0
- package/Misc/pure.js +1 -0
- package/Misc/pure.js.map +1 -1
- package/Misc/shaderImportLoader.d.ts +25 -0
- package/Misc/shaderImportLoader.js +54 -0
- package/Misc/shaderImportLoader.js.map +1 -0
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleClampBlock.pure.d.ts +0 -1
- package/Particles/Node/Blocks/particleClampBlock.pure.js +1 -6
- package/Particles/Node/Blocks/particleClampBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleMathBlock.pure.js +1 -1
- package/Particles/Node/Blocks/particleMathBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleNLerpBlock.pure.js +8 -3
- package/Particles/Node/Blocks/particleNLerpBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js +3 -2
- package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleStepBlock.pure.js +3 -2
- package/Particles/Node/Blocks/particleStepBlock.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.js +1 -1
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.d.ts +41 -1
- package/PostProcesses/imageProcessingPostProcess.js +41 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.pure.js +1 -1
- package/PostProcesses/sharpenPostProcess.pure.js.map +1 -1
- package/PostProcesses/thinImageProcessingPostProcess.d.ts +50 -0
- package/PostProcesses/thinImageProcessingPostProcess.js +65 -0
- package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.d.ts +12 -0
- package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js +22 -0
- package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.d.ts +1 -0
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js +39 -0
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.d.ts +12 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +17 -5
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +14 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +122 -6
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +7 -0
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +17 -0
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/IBLShadows/pure.d.ts +1 -0
- package/Rendering/IBLShadows/pure.js +1 -0
- package/Rendering/IBLShadows/pure.js.map +1 -1
- package/Rendering/boundingBoxRenderer.pure.js +3 -3
- package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +11 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js +36 -14
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +5 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +16 -3
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +5 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +12 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
- package/Rendering/iblCdfGenerator.js +10 -1
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Rendering/outlineRenderer.pure.js +1 -0
- package/Rendering/outlineRenderer.pure.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.js +1 -1
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Rendering/subSurfaceSceneComponent.pure.d.ts +1 -1
- package/Rendering/subSurfaceSceneComponent.pure.js +1 -1
- package/Rendering/subSurfaceSceneComponent.pure.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js +1 -1
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +2 -2
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/imageProcessingDeclaration.js +3 -0
- package/Shaders/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/imageProcessingFunctions.js +3 -0
- package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrDirectLighting.js +34 -4
- package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrIblFunctions.js +8 -2
- package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/fluidRenderingParticleDepth.vertex.js +7 -1
- package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
- package/Shaders/fluidRenderingParticleDiffuse.vertex.js +7 -1
- package/Shaders/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
- package/Shaders/fluidRenderingParticleThickness.vertex.js +7 -1
- package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingVoxel.fragment.js +4 -10
- package/Shaders/gaussianSplattingVoxel.fragment.js.map +1 -1
- package/Shaders/iblCombineVoxelGrids.fragment.js +1 -1
- package/Shaders/iblCombineVoxelGrids.fragment.js.map +1 -1
- package/Shaders/iblShadowVoxelTracing.fragment.js +24 -7
- package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js +13 -0
- package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +3 -0
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +35 -5
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +8 -2
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +16 -4
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js +15 -3
- package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -3
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingVoxel.fragment.js +15 -9
- package/ShadersWGSL/gaussianSplattingVoxel.fragment.js.map +1 -1
- package/ShadersWGSL/iblCombineVoxelGrids.fragment.js +1 -1
- package/ShadersWGSL/iblCombineVoxelGrids.fragment.js.map +1 -1
- package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.d.ts +5 -0
- package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js +14 -0
- package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js.map +1 -0
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +24 -7
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/ShadersWGSL/iblVoxelGrid.fragment.js +26 -6
- package/ShadersWGSL/iblVoxelGrid.fragment.js.map +1 -1
- package/SmartAssets/smartAssetManager.pure.js +1 -1
- package/SmartAssets/smartAssetManager.pure.js.map +1 -1
- package/Sprites/thinSprite.js +1 -1
- package/Sprites/thinSprite.js.map +1 -1
- package/XR/features/Layers/WebXRCompositionLayer.d.ts +182 -12
- package/XR/features/Layers/WebXRCompositionLayer.js +272 -3
- package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
- package/XR/features/Layers/WebXRFallbackLayer.d.ts +84 -0
- package/XR/features/Layers/WebXRFallbackLayer.js +137 -0
- package/XR/features/Layers/WebXRFallbackLayer.js.map +1 -0
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +4 -4
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.pure.d.ts +45 -0
- package/XR/features/WebXRAnchorSystem.pure.js +153 -13
- package/XR/features/WebXRAnchorSystem.pure.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.pure.js +2 -1
- package/XR/features/WebXRControllerPointerSelection.pure.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.pure.js +2 -1
- package/XR/features/WebXRControllerTeleportation.pure.js.map +1 -1
- package/XR/features/WebXRDepthSensing.pure.d.ts +21 -0
- package/XR/features/WebXRDepthSensing.pure.js +42 -0
- package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
- package/XR/features/WebXRHandTracking.pure.js +2 -0
- package/XR/features/WebXRHandTracking.pure.js.map +1 -1
- package/XR/features/WebXRLayers.pure.d.ts +183 -8
- package/XR/features/WebXRLayers.pure.js +531 -99
- package/XR/features/WebXRLayers.pure.js.map +1 -1
- package/XR/features/WebXRLayersFallback.d.ts +5 -0
- package/XR/features/WebXRLayersFallback.js +8 -0
- package/XR/features/WebXRLayersFallback.js.map +1 -0
- package/XR/features/WebXRLayersFallback.pure.d.ts +6 -0
- package/XR/features/WebXRLayersFallback.pure.js +44 -0
- package/XR/features/WebXRLayersFallback.pure.js.map +1 -0
- package/XR/features/WebXRLightEstimation.pure.d.ts +3 -4
- package/XR/features/WebXRLightEstimation.pure.js +22 -21
- package/XR/features/WebXRLightEstimation.pure.js.map +1 -1
- package/XR/features/WebXRMeshDetector.pure.d.ts +5 -0
- package/XR/features/WebXRMeshDetector.pure.js +1 -0
- package/XR/features/WebXRMeshDetector.pure.js.map +1 -1
- package/XR/features/WebXRNearInteraction.pure.js +3 -3
- package/XR/features/WebXRNearInteraction.pure.js.map +1 -1
- package/XR/features/WebXRPlaneDetector.pure.d.ts +9 -5
- package/XR/features/WebXRPlaneDetector.pure.js +12 -8
- package/XR/features/WebXRPlaneDetector.pure.js.map +1 -1
- package/XR/features/WebXRTrackedSources.d.ts +5 -0
- package/XR/features/WebXRTrackedSources.js +8 -0
- package/XR/features/WebXRTrackedSources.js.map +1 -0
- package/XR/features/WebXRTrackedSources.pure.d.ts +70 -0
- package/XR/features/WebXRTrackedSources.pure.js +153 -0
- package/XR/features/WebXRTrackedSources.pure.js.map +1 -0
- package/XR/features/index.d.ts +1 -0
- package/XR/features/index.js +1 -0
- package/XR/features/index.js.map +1 -1
- package/XR/features/pure.d.ts +2 -0
- package/XR/features/pure.js +2 -0
- package/XR/features/pure.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.d.ts +53 -1
- package/XR/motionController/webXRAbstractMotionController.js +61 -0
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/webXRCamera.d.ts +2 -0
- package/XR/webXRCamera.js +8 -2
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRDefaultExperience.js +8 -4
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXRExperienceHelper.js +86 -44
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRFeaturesManager.d.ts +9 -0
- package/XR/webXRFeaturesManager.js +4 -0
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRGraphicsBinding.d.ts +29 -0
- package/XR/webXRGraphicsBinding.js +40 -0
- package/XR/webXRGraphicsBinding.js.map +1 -1
- package/XR/webXRInputSource.js +1 -1
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRLayerWrapper.d.ts +26 -10
- package/XR/webXRLayerWrapper.js +19 -7
- package/XR/webXRLayerWrapper.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.d.ts +4 -4
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +45 -0
- package/XR/webXRSessionManager.js +174 -29
- package/XR/webXRSessionManager.js.map +1 -1
- package/XR/webXRWebGLRenderTargetTextureProvider.d.ts +2 -1
- package/XR/webXRWebGLRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +3 -3
- package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
- package/package.json +1 -1
- package/scene.pure.d.ts +5 -0
- package/scene.pure.js +25 -0
- package/scene.pure.js.map +1 -1
|
@@ -10,10 +10,34 @@ import { Logger } from "../../Misc/logger.js";
|
|
|
10
10
|
import { Observable } from "../../Misc/observable.pure.js";
|
|
11
11
|
import { ProceduralTexture } from "../../Materials/Textures/Procedurals/proceduralTexture.pure.js";
|
|
12
12
|
import { EffectRenderer, EffectWrapper } from "../../Materials/effectRenderer.pure.js";
|
|
13
|
+
import { StorageBuffer } from "../../Buffers/storageBuffer.js";
|
|
14
|
+
import { ComputeShader } from "../../Compute/computeShader.pure.js";
|
|
13
15
|
import { IsGaussianSplattingClassName } from "../../Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js";
|
|
14
16
|
// Max frames _renderVoxelGrid waits for splat depth sorts to settle before voxelizing anyway
|
|
15
17
|
// (~3s at 60fps). Bounds the wait so a continuously re-sorting (orbiting) splat can't block it.
|
|
16
18
|
const _MaxSortSettleWaitFrames = 180;
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if any of the given meshes (or their children) is a Gaussian splatting mesh.
|
|
21
|
+
* Used to decide whether WebGPU voxelization needs the opacity accumulator buffer + copy pass.
|
|
22
|
+
* @param meshes meshes included in the voxelization
|
|
23
|
+
* @returns whether any included mesh (or child) is a Gaussian splatting mesh
|
|
24
|
+
*/
|
|
25
|
+
function _HasGaussianSplatting(meshes) {
|
|
26
|
+
for (const mesh of meshes) {
|
|
27
|
+
if (!mesh) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (IsGaussianSplattingClassName(mesh.getClassName())) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
for (const child of mesh.getChildMeshes()) {
|
|
34
|
+
if (IsGaussianSplattingClassName(child.getClassName())) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
17
41
|
/**
|
|
18
42
|
* Voxel-based shadow rendering for IBL's.
|
|
19
43
|
* This should not be instanciated directly, as it is part of a scene component
|
|
@@ -69,8 +93,8 @@ export class _IblShadowsVoxelRenderer {
|
|
|
69
93
|
if (this._triPlanarVoxelization === enabled) {
|
|
70
94
|
return;
|
|
71
95
|
}
|
|
72
|
-
this._triPlanarVoxelization = enabled;
|
|
73
96
|
this._disposeVoxelTextures();
|
|
97
|
+
this._triPlanarVoxelization = enabled;
|
|
74
98
|
this._createTextures();
|
|
75
99
|
}
|
|
76
100
|
/**
|
|
@@ -116,6 +140,7 @@ export class _IblShadowsVoxelRenderer {
|
|
|
116
140
|
this._voxelMrtsXaxis = [];
|
|
117
141
|
this._voxelMrtsYaxis = [];
|
|
118
142
|
this._voxelMrtsZaxis = [];
|
|
143
|
+
this._useOpacityBuffer = false;
|
|
119
144
|
this._voxelClearColor = new Color4(0, 0, 0, 1);
|
|
120
145
|
/**
|
|
121
146
|
* Observable that triggers when the voxelization is complete
|
|
@@ -300,6 +325,8 @@ export class _IblShadowsVoxelRenderer {
|
|
|
300
325
|
creationFlags: 1,
|
|
301
326
|
});
|
|
302
327
|
this._voxelGridRT = new RenderTargetTexture("voxelGridRT", { width: Math.min(size.width * 2.0, 2048), height: Math.min(size.height * 2.0, 2048) }, this._scene, voxelAxisOptions);
|
|
328
|
+
// The opacity accumulator is created lazily, only when a voxelization includes Gaussian
|
|
329
|
+
// splats (see _ensureVoxelOpacityAccumulator).
|
|
303
330
|
}
|
|
304
331
|
else if (this._triPlanarVoxelization) {
|
|
305
332
|
this._voxelGridXaxis = new RenderTargetTexture("voxelGridXaxis", size, this._scene, voxelAxisOptions);
|
|
@@ -318,6 +345,7 @@ export class _IblShadowsVoxelRenderer {
|
|
|
318
345
|
this._combinedVoxelGridPT.autoClear = false;
|
|
319
346
|
this._combinedVoxelGridPT.wrapU = Texture.CLAMP_ADDRESSMODE;
|
|
320
347
|
this._combinedVoxelGridPT.wrapV = Texture.CLAMP_ADDRESSMODE;
|
|
348
|
+
this._combinedVoxelGridPT.wrapR = Texture.CLAMP_ADDRESSMODE;
|
|
321
349
|
}
|
|
322
350
|
else {
|
|
323
351
|
this._voxelGridZaxis = new RenderTargetTexture("voxelGridZaxis", size, this._scene, voxelCombinedOptions);
|
|
@@ -349,14 +377,55 @@ export class _IblShadowsVoxelRenderer {
|
|
|
349
377
|
mipTarget.autoClear = false;
|
|
350
378
|
mipTarget.wrapU = Texture.CLAMP_ADDRESSMODE;
|
|
351
379
|
mipTarget.wrapV = Texture.CLAMP_ADDRESSMODE;
|
|
380
|
+
mipTarget.wrapR = Texture.CLAMP_ADDRESSMODE;
|
|
352
381
|
mipTarget.setTexture("srcMip", mipIdx > 1 ? this._mipArray[mipIdx - 2] : this.getVoxelGrid());
|
|
353
382
|
mipTarget.setInt("layerNum", 0);
|
|
354
383
|
}
|
|
355
384
|
this._createVoxelMaterials();
|
|
356
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* WebGPU only. Allocates the opacity accumulator buffer and the compute shader that copies it into
|
|
388
|
+
* the r8 grid. Storage textures can't blend or do float atomics, so splats accumulate via atomicMax
|
|
389
|
+
* and this compute pass decodes the result into mip 0.
|
|
390
|
+
*/
|
|
391
|
+
_ensureVoxelOpacityAccumulator() {
|
|
392
|
+
if (this._voxelOpacityBuffer) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const res = this._voxelResolution;
|
|
396
|
+
// Packed 4 voxels/u32, so res^3 bytes. res is a power of two >= 8, so res^3 is a multiple of 4.
|
|
397
|
+
this._voxelOpacityBuffer = new StorageBuffer(this._engine, res * res * res);
|
|
398
|
+
void (async () => {
|
|
399
|
+
await import("../../ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js");
|
|
400
|
+
this._copyBufferToGridCompute = new ComputeShader("iblCopyVoxelBufferToGrid", this._engine, "iblCopyVoxelBufferToGrid", {
|
|
401
|
+
bindingsMapping: {
|
|
402
|
+
voxelOpacityBuffer: { group: 0, binding: 0 },
|
|
403
|
+
voxelGridTarget: { group: 0, binding: 1 },
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
})();
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* WebGPU only. Dispatches the compute pass that decodes the per-voxel opacity accumulator buffer
|
|
410
|
+
* into the r8 voxel grid (mip 0). Runs after all voxelization passes and before mip generation.
|
|
411
|
+
*/
|
|
412
|
+
_copyVoxelOpacityBufferToGrid() {
|
|
413
|
+
const compute = this._copyBufferToGridCompute;
|
|
414
|
+
if (!compute || !this._voxelOpacityBuffer) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
compute.setStorageBuffer("voxelOpacityBuffer", this._voxelOpacityBuffer);
|
|
418
|
+
compute.setStorageTexture("voxelGridTarget", this._voxelGrid);
|
|
419
|
+
// Workgroup size is 4x4x4; cover the whole grid.
|
|
420
|
+
const groups = Math.ceil(this._voxelResolution / 4);
|
|
421
|
+
compute.dispatch(groups, groups, groups);
|
|
422
|
+
}
|
|
357
423
|
_createVoxelMRTs(name, voxelRT, numSlabs) {
|
|
358
424
|
voxelRT.wrapU = Texture.CLAMP_ADDRESSMODE;
|
|
359
425
|
voxelRT.wrapV = Texture.CLAMP_ADDRESSMODE;
|
|
426
|
+
// 3D texture: clamp the depth (R) axis too. The combine shader samples each grid with the depth
|
|
427
|
+
// coordinate spanning [0,1], so without this it wraps to the opposite face at the boundaries.
|
|
428
|
+
voxelRT.wrapR = Texture.CLAMP_ADDRESSMODE;
|
|
360
429
|
voxelRT.noPrePassRenderer = true;
|
|
361
430
|
const mrtArray = [];
|
|
362
431
|
const targetTypes = new Array(this._maxDrawBuffers).fill(32879);
|
|
@@ -406,6 +475,12 @@ export class _IblShadowsVoxelRenderer {
|
|
|
406
475
|
mip.dispose();
|
|
407
476
|
}
|
|
408
477
|
this._voxelMaterial?.dispose();
|
|
478
|
+
this._voxelOpacityBuffer?.dispose();
|
|
479
|
+
this._voxelOpacityBuffer = undefined;
|
|
480
|
+
this._copyBufferToGridCompute = undefined;
|
|
481
|
+
// The recreated _voxelMaterial has no IBL_VOXEL_OPACITY_BUFFER define; reset the flag so
|
|
482
|
+
// updateVoxelGrid re-adds it (its change check would otherwise skip it after a resolution change).
|
|
483
|
+
this._useOpacityBuffer = false;
|
|
409
484
|
this._mipArray = [];
|
|
410
485
|
this._voxelMrtsXaxis = [];
|
|
411
486
|
this._voxelMrtsYaxis = [];
|
|
@@ -415,6 +490,8 @@ export class _IblShadowsVoxelRenderer {
|
|
|
415
490
|
const isWebGPU = this._engine.isWebGPU;
|
|
416
491
|
this._voxelMaterial = new ShaderMaterial("voxelization", this._scene, "iblVoxelGrid", {
|
|
417
492
|
uniforms: ["world", "viewMatrix", "invTransWorld", "invWorldScale", "nearPlane", "farPlane", "stepSize"],
|
|
493
|
+
// WebGPU accumulates non-binary voxel opacity via atomicMax into this storage buffer.
|
|
494
|
+
storageBuffers: isWebGPU ? ["voxelOpacityBuffer"] : [],
|
|
418
495
|
defines: ["MAX_DRAW_BUFFERS " + this._maxDrawBuffers],
|
|
419
496
|
shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,
|
|
420
497
|
extraInitializationsAsync: async () => {
|
|
@@ -490,6 +567,18 @@ export class _IblShadowsVoxelRenderer {
|
|
|
490
567
|
}
|
|
491
568
|
this._stopVoxelization();
|
|
492
569
|
this._voxelizationInProgress = true;
|
|
570
|
+
if (this._engine.isWebGPU) {
|
|
571
|
+
// Route through the opacity accumulator only when Gaussian splats are present (they need
|
|
572
|
+
// non-binary accumulation). Regular-mesh-only voxelization writes the grid directly.
|
|
573
|
+
const useBuffer = _HasGaussianSplatting(includedMeshes);
|
|
574
|
+
if (useBuffer) {
|
|
575
|
+
this._ensureVoxelOpacityAccumulator();
|
|
576
|
+
}
|
|
577
|
+
if (useBuffer !== this._useOpacityBuffer) {
|
|
578
|
+
this._useOpacityBuffer = useBuffer;
|
|
579
|
+
this._voxelMaterial.setDefine("IBL_VOXEL_OPACITY_BUFFER", useBuffer);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
493
582
|
if (this._engine.isWebGPU) {
|
|
494
583
|
this._voxelGridRT.renderList = includedMeshes;
|
|
495
584
|
this._addRTsForRender([this._voxelGridRT], includedMeshes, 0);
|
|
@@ -564,10 +653,18 @@ export class _IblShadowsVoxelRenderer {
|
|
|
564
653
|
return;
|
|
565
654
|
}
|
|
566
655
|
if (this._engine.isWebGPU) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
656
|
+
if (this._useOpacityBuffer) {
|
|
657
|
+
// The copy compute must be ready before we voxelize, else the grid stays unpopulated.
|
|
658
|
+
if (!this._copyBufferToGridCompute || !this._copyBufferToGridCompute.isReady()) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
// Reset the accumulator. clear() is a command-encoder op, so it must run before any
|
|
662
|
+
// render pass opens (here, not mid-render).
|
|
663
|
+
this._voxelOpacityBuffer?.clear();
|
|
664
|
+
}
|
|
665
|
+
else if (this._voxelGrid && this._voxelGrid.renderTarget) {
|
|
666
|
+
// Direct mode (no splats): regular meshes textureStore into the grid, so clear each
|
|
667
|
+
// layer first.
|
|
571
668
|
for (let layer = 0; layer < this._voxelResolution; layer++) {
|
|
572
669
|
this._engine.bindFramebuffer(this._voxelGrid.renderTarget, 0, undefined, undefined, true, 0, layer);
|
|
573
670
|
this._engine.clear(this._voxelClearColor, true, false, false);
|
|
@@ -579,7 +676,13 @@ export class _IblShadowsVoxelRenderer {
|
|
|
579
676
|
rt.render();
|
|
580
677
|
}
|
|
581
678
|
this._stopVoxelization();
|
|
582
|
-
if (this.
|
|
679
|
+
if (this._engine.isWebGPU) {
|
|
680
|
+
if (this._useOpacityBuffer) {
|
|
681
|
+
// Decode the atomically-accumulated opacity buffer into the r8 voxel grid (mip 0).
|
|
682
|
+
this._copyVoxelOpacityBufferToGrid();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
else if (this._triPlanarVoxelization) {
|
|
583
686
|
this._combinedVoxelGridPT.render();
|
|
584
687
|
}
|
|
585
688
|
this._generateMipMaps();
|
|
@@ -640,7 +743,14 @@ export class _IblShadowsVoxelRenderer {
|
|
|
640
743
|
}
|
|
641
744
|
}
|
|
642
745
|
else {
|
|
746
|
+
// Accumulate overlapping splats with a MAX blend equation (dst = max(src, dst)) so each
|
|
747
|
+
// cell keeps the strongest occluder; writing 0.0 into non-slab draw buffers is a no-op.
|
|
748
|
+
// Matches the WebGPU atomicMax path; see the opacity-compositing limitation in
|
|
749
|
+
// iblVoxelOpacityAtomicMax.
|
|
750
|
+
const previousAlphaMode = engine.getAlphaMode();
|
|
751
|
+
engine.setAlphaMode(19, true);
|
|
643
752
|
renderingMesh._processRendering(effectiveMesh, sm, effect, fillMode, batch, hardwareInstancedRendering, (_isInstance, world) => effect.setMatrix("world", world));
|
|
753
|
+
engine.setAlphaMode(previousAlphaMode, true);
|
|
644
754
|
}
|
|
645
755
|
gsVoxelMaterial.unbind();
|
|
646
756
|
};
|
|
@@ -722,6 +832,9 @@ export class _IblShadowsVoxelRenderer {
|
|
|
722
832
|
if (this._engine.isWebGPU) {
|
|
723
833
|
this._voxelMaterial.useVertexPulling = true;
|
|
724
834
|
this._voxelMaterial.setTexture("voxel_storage", this.getVoxelGrid());
|
|
835
|
+
if (this._voxelOpacityBuffer) {
|
|
836
|
+
this._voxelMaterial.setStorageBuffer("voxelOpacityBuffer", this._voxelOpacityBuffer);
|
|
837
|
+
}
|
|
725
838
|
}
|
|
726
839
|
// Push per-slab uniforms to each GS voxel material in this MRT's render list.
|
|
727
840
|
for (const m of mrt.renderList ?? []) {
|
|
@@ -732,6 +845,9 @@ export class _IblShadowsVoxelRenderer {
|
|
|
732
845
|
if (this._engine.isWebGPU) {
|
|
733
846
|
// WGSL GS voxel shader uses the same viewMatrix approach as WebGL; the per-axis viewMatrix is set per-draw in renderGsSplat.
|
|
734
847
|
gsVoxelMat.setTexture("voxel_storage", this.getVoxelGrid());
|
|
848
|
+
if (this._voxelOpacityBuffer) {
|
|
849
|
+
gsVoxelMat.setStorageBuffer("voxelOpacityBuffer", this._voxelOpacityBuffer);
|
|
850
|
+
}
|
|
735
851
|
}
|
|
736
852
|
else {
|
|
737
853
|
gsVoxelMat.setMatrix("viewMatrix", viewMatrix);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iblShadowsVoxelRenderer.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAmC,MAAM,mDAAmD,CAAC;AAEzH,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAK/D,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAA0C,MAAM,6DAA6D,CAAC;AACxI,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAIpF,OAAO,EAA8B,4BAA4B,EAAE,MAAM,2DAA2D,CAAC;AAGrI,6FAA6F;AAC7F,gGAAgG;AAChG,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC;;;;;GAKG;AACH,MAAM,OAAO,w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CAAC;IACnE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3E,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC;CACtE,AAJ2C,CAI1C","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { Constants } from \"../../Engines/constants\";\nimport { type Engine } from \"../../Engines/engine.pure\";\nimport { ShaderMaterial } from \"../../Materials/shaderMaterial.pure\";\nimport { MultiRenderTarget } from \"../../Materials/Textures/multiRenderTarget.pure\";\nimport { RenderTargetTexture, type RenderTargetTextureOptions } from \"../../Materials/Textures/renderTargetTexture.pure\";\nimport { type TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\nimport { Color4 } from \"../../Maths/math.color.pure\";\nimport { Matrix, Vector3 } from \"../../Maths/math.vector.pure\";\nimport { type Mesh } from \"../../Meshes/mesh.pure\";\nimport { type SubMesh } from \"../../Meshes/subMesh.pure\";\nimport { type Scene } from \"../../scene.pure\";\nimport { type SmartArray } from \"../../Misc/smartArray\";\nimport { Texture } from \"../../Materials/Textures/texture.pure\";\nimport { Logger } from \"../../Misc/logger\";\nimport { Observable } from \"../../Misc/observable.pure\";\nimport { ProceduralTexture, type IProceduralTextureCreationOptions } from \"../../Materials/Textures/Procedurals/proceduralTexture.pure\";\nimport { EffectRenderer, EffectWrapper } from \"../../Materials/effectRenderer.pure\";\nimport { type IblShadowsRenderPipeline } from \"./iblShadowsRenderPipeline.pure\";\nimport { type RenderTargetWrapper } from \"core/Engines/renderTargetWrapper\";\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\nimport { type GaussianSplattingMesh, IsGaussianSplattingClassName } from \"../../Meshes/GaussianSplatting/gaussianSplattingMesh.pure\";\nimport { type GaussianSplattingMaterial } from \"../../Materials/GaussianSplatting/gaussianSplattingMaterial.pure\";\n\n// Max frames _renderVoxelGrid waits for splat depth sorts to settle before voxelizing anyway\n// (~3s at 60fps). Bounds the wait so a continuously re-sorting (orbiting) splat can't block it.\nconst _MaxSortSettleWaitFrames = 180;\n\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 * @internal\n * @see https://playground.babylonjs.com/#8R5SSE#222\n */\nexport class _IblShadowsVoxelRenderer {\n // View matrices for the three voxelization axes.\n private static readonly _VOXEL_VIEW_MATRICES = [\n Matrix.LookAtLH(Vector3.Zero(), new Vector3(1, 0, 0), Vector3.Up()),\n Matrix.LookAtLH(Vector3.Zero(), new Vector3(0, 1, 0), new Vector3(1, 0, 0)),\n Matrix.LookAtLH(Vector3.Zero(), new Vector3(0, 0, 1), Vector3.Up()),\n ];\n\n private _scene: Scene;\n private _engine: Engine;\n\n // WebGPU, single-pass voxelization.\n // See https://playground.babylonjs.com/#XSNYAU#133\n private _voxelGrid: RenderTargetTexture;\n private _voxelGridRT: RenderTargetTexture;\n\n // WebGL voxelization, including tri-planar voxelization.\n private _combinedVoxelGridPT: ProceduralTexture;\n private _voxelGridXaxis: RenderTargetTexture;\n private _voxelGridYaxis: RenderTargetTexture;\n private _voxelGridZaxis: RenderTargetTexture;\n private _voxelMrtsXaxis: MultiRenderTarget[] = [];\n private _voxelMrtsYaxis: MultiRenderTarget[] = [];\n private _voxelMrtsZaxis: MultiRenderTarget[] = [];\n\n private _voxelMaterial: ShaderMaterial;\n private _voxelClearColor: Color4 = new Color4(0, 0, 0, 1);\n\n /**\n * Return the voxel grid texture.\n * @returns The voxel grid texture.\n */\n public getVoxelGrid(): ProceduralTexture | RenderTargetTexture {\n if (this._engine.isWebGPU) {\n return this._voxelGrid;\n } else if (this._triPlanarVoxelization) {\n return this._combinedVoxelGridPT;\n } else {\n return this._voxelGridZaxis;\n }\n }\n\n /**\n * Return the voxel render target used during voxelization.\n * @returns The voxel render target.\n */\n public getRT(): ProceduralTexture | RenderTargetTexture {\n if (this._engine.isWebGPU) {\n return this._voxelGridRT;\n } else if (this._triPlanarVoxelization) {\n return this._combinedVoxelGridPT;\n } else {\n return this._voxelGridZaxis;\n }\n }\n\n /**\n * Observable that triggers when the voxelization is complete\n */\n public onVoxelizationCompleteObservable: Observable<void> = new Observable<void>();\n\n private _maxDrawBuffers: number;\n private _renderTargets: RenderTargetTexture[] = [];\n\n /** Per-mesh voxel ShaderMaterials for GaussianSplattingMesh, keyed by mesh uniqueId. */\n private _gsVoxelMaterialCache: Map<number, ShaderMaterial> = new Map();\n\n private _triPlanarVoxelization: boolean = true;\n\n /**\n * Whether to use tri-planar voxelization. More expensive, but can help with artifacts.\n */\n public get triPlanarVoxelization(): boolean {\n return this._triPlanarVoxelization;\n }\n\n /**\n * Whether to use tri-planar voxelization. More expensive, but can help with artifacts.\n */\n public set triPlanarVoxelization(enabled: boolean) {\n if (this._engine.isWebGPU) {\n // WebGPU only supports tri-planar voxelization.\n this._triPlanarVoxelization = true;\n return;\n }\n if (this._triPlanarVoxelization === enabled) {\n return;\n }\n this._triPlanarVoxelization = enabled;\n this._disposeVoxelTextures();\n this._createTextures();\n }\n\n private _voxelizationInProgress: boolean = false;\n // Frames spent waiting for shadow-casting splats' depth sort to settle before voxelizing; see\n // _renderVoxelGrid. Capped so a continuously re-sorting (e.g. orbiting) splat can't starve it.\n private _sortSettleWaitFrames: number = 0;\n private _invWorldScaleMatrix: Matrix = Matrix.Identity();\n\n /**\n * Set the matrix to use for scaling the world space to voxel space\n * @param matrix The matrix to use for scaling the world space to voxel space\n */\n public setWorldScaleMatrix(matrix: Matrix) {\n this._invWorldScaleMatrix = matrix;\n }\n\n /**\n * @returns Whether voxelization is currently happening.\n */\n public isVoxelizationInProgress(): boolean {\n return this._voxelizationInProgress;\n }\n\n private _voxelResolution: number = 64;\n private _voxelResolutionExp: number = 6;\n\n /**\n * Resolution of the voxel grid. The final resolution will be 2^resolutionExp.\n */\n public get voxelResolutionExp(): number {\n return this._voxelResolutionExp;\n }\n\n /**\n * Resolution of the voxel grid. The final resolution will be 2^resolutionExp.\n */\n public set voxelResolutionExp(resolutionExp: number) {\n if (this._voxelResolutionExp === resolutionExp && this._voxelGridZaxis) {\n return;\n }\n this._voxelResolutionExp = Math.round(Math.min(Math.max(resolutionExp, 3), 9));\n this._voxelResolution = Math.pow(2.0, this._voxelResolutionExp);\n this._disposeVoxelTextures();\n this._createTextures();\n }\n\n private _copyMipEffectRenderer: EffectRenderer;\n private _copyMipEffectWrapper: EffectWrapper;\n private _copyMipSourceTexture?: ProceduralTexture;\n private _copyMipLayer = 0;\n private _mipArray: ProceduralTexture[] = [];\n\n /**\n * Instanciates the voxel renderer\n * @param scene Scene to attach to\n * @param iblShadowsRenderPipeline The render pipeline this pass is associated with\n * @param resolutionExp Resolution of the voxel grid. The final resolution will be 2^resolutionExp.\n * @param triPlanarVoxelization Whether to use tri-planar voxelization. Only applies to WebGL. Voxelization will take longer but will reduce missing geometry.\n * @returns The voxel renderer\n */\n constructor(scene: Scene, iblShadowsRenderPipeline: IblShadowsRenderPipeline, resolutionExp: number = 6, triPlanarVoxelization: boolean = true) {\n this._scene = scene;\n this._engine = scene.getEngine() as Engine;\n this._triPlanarVoxelization = this._engine.isWebGPU || triPlanarVoxelization;\n if (!this._engine.getCaps().drawBuffersExtension) {\n Logger.Error(\"Can't do voxel rendering without the draw buffers extension.\");\n }\n\n const isWebGPU = this._engine.isWebGPU;\n // Round down to a power of 2 so it evenly divides the power-of-2 voxel resolution,\n // preventing out-of-bounds layer indices in the last MRT slab.\n // This shader implementation writes up to 16 MRT outputs, so clamp to 16 to keep\n // active draw buffers aligned with declared/written fragment outputs.\n const rawMaxDrawBuffers = this._engine.getCaps().maxDrawBuffers || 0;\n const cappedMaxDrawBuffers = Math.min(rawMaxDrawBuffers, 16);\n this._maxDrawBuffers = cappedMaxDrawBuffers >= 1 ? 1 << Math.floor(Math.log2(cappedMaxDrawBuffers)) : 0;\n\n this._copyMipEffectRenderer = new EffectRenderer(this._engine);\n this._copyMipEffectWrapper = new EffectWrapper({\n engine: this._engine,\n fragmentShader: \"copyTexture3DLayerToTexture\",\n useShaderStore: true,\n uniformNames: [\"layerNum\"],\n samplerNames: [\"textureSampler\"],\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await import(\"../../ShadersWGSL/copyTexture3DLayerToTexture.fragment\");\n } else {\n await import(\"../../Shaders/copyTexture3DLayerToTexture.fragment\");\n }\n },\n });\n this._copyMipEffectWrapper.onApplyObservable.add(() => {\n const effect = this._copyMipEffectWrapper.effect;\n if (!effect || !this._copyMipSourceTexture) {\n return;\n }\n\n effect.setTexture(\"textureSampler\", this._copyMipSourceTexture);\n effect.setInt(\"layerNum\", this._copyMipLayer);\n });\n\n this.voxelResolutionExp = resolutionExp;\n }\n\n private _generateMipMaps() {\n const iterations = Math.ceil(Math.log2(this._voxelResolution));\n for (let i = 1; i < iterations + 1; i++) {\n this._generateMipMap(i);\n }\n }\n\n private _generateMipMap(lodLevel: number) {\n // Generate a mip map for the given level by triggering the render of the procedural mip texture.\n const mipTarget = this._mipArray[lodLevel - 1];\n if (!mipTarget) {\n return;\n }\n\n mipTarget.setTexture(\"srcMip\", lodLevel === 1 ? this.getVoxelGrid() : this._mipArray[lodLevel - 2]);\n mipTarget.render();\n }\n\n private _copyMipMaps() {\n const iterations = Math.ceil(Math.log2(this._voxelResolution));\n for (let i = 1; i < iterations + 1; i++) {\n this._copyMipMap(i);\n }\n }\n\n private _copyMipMap(lodLevel: number) {\n // Now, copy this mip into the mip chain of the voxel grid.\n const mipTarget = this._mipArray[lodLevel - 1];\n if (!mipTarget) {\n return;\n }\n const voxelGrid = this.getVoxelGrid();\n let rt: RenderTargetWrapper;\n if (voxelGrid instanceof RenderTargetTexture && voxelGrid.renderTarget) {\n rt = voxelGrid.renderTarget;\n } else {\n rt = (voxelGrid as any)._rtWrapper;\n }\n if (rt) {\n this._copyMipEffectRenderer.saveStates();\n const previousColorWrite = this._engine.getColorWrite();\n const previousDepthBuffer = this._engine.getDepthBuffer();\n const previousDepthWrite = this._engine.getDepthWrite();\n const previousAlphaMode = this._engine.getAlphaMode();\n this._engine.setColorWrite(true);\n this._engine.setDepthBuffer(false);\n this._engine.setDepthWrite(false);\n this._engine.setAlphaMode(Constants.ALPHA_DISABLE);\n const bindSize = mipTarget.getSize().width;\n let sourceDepth = mipTarget.getInternalTexture()?.depth;\n sourceDepth = Math.max(1, sourceDepth || bindSize);\n const destinationMipDepth = Math.max(1, this._voxelResolution >> lodLevel);\n const layersToCopy = Math.min(sourceDepth, destinationMipDepth);\n const destinationTexture = rt.texture;\n const previousGenerateMipMaps = destinationTexture?.generateMipMaps;\n\n if (destinationTexture) {\n destinationTexture.generateMipMaps = false;\n }\n\n try {\n // Render to each layer of the voxel grid.\n for (let layer = 0; layer < layersToCopy; layer++) {\n this._engine.bindFramebuffer(rt, 0, bindSize, bindSize, true, lodLevel, layer);\n this._copyMipSourceTexture = mipTarget;\n this._copyMipLayer = layer;\n this._copyMipEffectRenderer.applyEffectWrapper(this._copyMipEffectWrapper);\n this._copyMipEffectRenderer.draw();\n this._engine.unBindFramebuffer(rt, true);\n }\n\n if (!this._engine.isWebGPU) {\n this._engine.unbindAllTextures();\n }\n } finally {\n if (destinationTexture && previousGenerateMipMaps !== undefined) {\n destinationTexture.generateMipMaps = previousGenerateMipMaps;\n }\n this._engine.setAlphaMode(previousAlphaMode);\n this._engine.setDepthWrite(previousDepthWrite);\n this._engine.setDepthBuffer(previousDepthBuffer);\n this._engine.setColorWrite(previousColorWrite);\n }\n\n this._copyMipSourceTexture = undefined;\n this._copyMipEffectRenderer.restoreStates();\n }\n }\n\n private _computeNumberOfSlabs(): number {\n return Math.ceil(this._voxelResolution / this._maxDrawBuffers);\n }\n\n private _createTextures() {\n const isWebGPU = this._engine.isWebGPU;\n const size: TextureSize = {\n width: this._voxelResolution,\n height: this._voxelResolution,\n depth: this._voxelResolution,\n };\n const voxelAxisOptions: RenderTargetTextureOptions = {\n generateDepthBuffer: false,\n generateMipMaps: false,\n type: Constants.TEXTURETYPE_UNSIGNED_BYTE,\n format: Constants.TEXTUREFORMAT_R,\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n };\n\n // We can render up to maxDrawBuffers voxel slices of the grid per render.\n // We call this a slab.\n const numSlabs = this._computeNumberOfSlabs();\n const voxelCombinedOptions: IProceduralTextureCreationOptions = {\n generateDepthBuffer: false,\n generateMipMaps: true,\n type: Constants.TEXTURETYPE_UNSIGNED_BYTE,\n format: Constants.TEXTUREFORMAT_R,\n samplingMode: Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST,\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await import(\"../../ShadersWGSL/iblCombineVoxelGrids.fragment\");\n } else {\n await import(\"../../Shaders/iblCombineVoxelGrids.fragment\");\n }\n },\n };\n if (this._engine.isWebGPU) {\n this._voxelGrid = new RenderTargetTexture(\"voxelGrid\", size, this._scene, {\n ...voxelCombinedOptions,\n format: Constants.TEXTUREFORMAT_R,\n creationFlags: Constants.TEXTURE_CREATIONFLAG_STORAGE,\n });\n this._voxelGridRT = new RenderTargetTexture(\n \"voxelGridRT\",\n { width: Math.min(size.width * 2.0, 2048), height: Math.min(size.height * 2.0, 2048) },\n this._scene,\n voxelAxisOptions\n );\n } else if (this._triPlanarVoxelization) {\n this._voxelGridXaxis = new RenderTargetTexture(\"voxelGridXaxis\", size, this._scene, voxelAxisOptions);\n this._voxelGridYaxis = new RenderTargetTexture(\"voxelGridYaxis\", size, this._scene, voxelAxisOptions);\n this._voxelGridZaxis = new RenderTargetTexture(\"voxelGridZaxis\", size, this._scene, voxelAxisOptions);\n this._voxelMrtsXaxis = this._createVoxelMRTs(\"x_axis_\", this._voxelGridXaxis, numSlabs);\n this._voxelMrtsYaxis = this._createVoxelMRTs(\"y_axis_\", this._voxelGridYaxis, numSlabs);\n this._voxelMrtsZaxis = this._createVoxelMRTs(\"z_axis_\", this._voxelGridZaxis, numSlabs);\n\n this._combinedVoxelGridPT = new ProceduralTexture(\"combinedVoxelGrid\", size, \"iblCombineVoxelGrids\", this._scene, voxelCombinedOptions, false);\n this._scene.proceduralTextures.splice(this._scene.proceduralTextures.indexOf(this._combinedVoxelGridPT), 1);\n this._combinedVoxelGridPT.setFloat(\"layer\", 0.0);\n this._combinedVoxelGridPT.setTexture(\"voxelXaxisSampler\", this._voxelGridXaxis);\n this._combinedVoxelGridPT.setTexture(\"voxelYaxisSampler\", this._voxelGridYaxis);\n this._combinedVoxelGridPT.setTexture(\"voxelZaxisSampler\", this._voxelGridZaxis);\n // We will render this only after voxelization is completed for the 3 axes.\n this._combinedVoxelGridPT.autoClear = false;\n this._combinedVoxelGridPT.wrapU = Texture.CLAMP_ADDRESSMODE;\n this._combinedVoxelGridPT.wrapV = Texture.CLAMP_ADDRESSMODE;\n } else {\n this._voxelGridZaxis = new RenderTargetTexture(\"voxelGridZaxis\", size, this._scene, voxelCombinedOptions);\n this._voxelMrtsZaxis = this._createVoxelMRTs(\"z_axis_\", this._voxelGridZaxis, numSlabs);\n }\n\n const generateVoxelMipOptions: IProceduralTextureCreationOptions = {\n generateDepthBuffer: false,\n generateMipMaps: false,\n type: Constants.TEXTURETYPE_UNSIGNED_BYTE,\n format: Constants.TEXTUREFORMAT_R,\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await import(\"../../ShadersWGSL/iblGenerateVoxelMip.fragment\");\n } else {\n await import(\"../../Shaders/iblGenerateVoxelMip.fragment\");\n }\n },\n };\n this._mipArray = new Array(Math.ceil(Math.log2(this._voxelResolution)));\n for (let mipIdx = 1; mipIdx <= this._mipArray.length; mipIdx++) {\n const mipDim = this._voxelResolution >> mipIdx;\n const mipSize: TextureSize = { width: mipDim, height: mipDim, depth: mipDim };\n this._mipArray[mipIdx - 1] = new ProceduralTexture(\"voxelMip\" + mipIdx, mipSize, \"iblGenerateVoxelMip\", this._scene, generateVoxelMipOptions, false);\n this._scene.proceduralTextures.splice(this._scene.proceduralTextures.indexOf(this._mipArray[mipIdx - 1]), 1);\n\n const mipTarget = this._mipArray[mipIdx - 1];\n mipTarget.autoClear = false;\n mipTarget.wrapU = Texture.CLAMP_ADDRESSMODE;\n mipTarget.wrapV = Texture.CLAMP_ADDRESSMODE;\n mipTarget.setTexture(\"srcMip\", mipIdx > 1 ? this._mipArray[mipIdx - 2] : this.getVoxelGrid());\n mipTarget.setInt(\"layerNum\", 0);\n }\n\n this._createVoxelMaterials();\n }\n\n private _createVoxelMRTs(name: string, voxelRT: RenderTargetTexture, numSlabs: number): MultiRenderTarget[] {\n voxelRT.wrapU = Texture.CLAMP_ADDRESSMODE;\n voxelRT.wrapV = Texture.CLAMP_ADDRESSMODE;\n voxelRT.noPrePassRenderer = true;\n const mrtArray: MultiRenderTarget[] = [];\n const targetTypes = new Array(this._maxDrawBuffers).fill(Constants.TEXTURE_3D);\n\n for (let mrtIndex = 0; mrtIndex < numSlabs; mrtIndex++) {\n let layerIndices = new Array(this._maxDrawBuffers).fill(0);\n layerIndices = layerIndices.map((value, index) => mrtIndex * this._maxDrawBuffers + index);\n\n let textureNames = new Array(this._maxDrawBuffers).fill(\"\");\n textureNames = textureNames.map((value, index) => \"voxel_grid_\" + name + (mrtIndex * this._maxDrawBuffers + index));\n\n const mrt = new MultiRenderTarget(\n \"mrt_\" + name + mrtIndex,\n { width: this._voxelResolution, height: this._voxelResolution, depth: this._voxelResolution },\n this._maxDrawBuffers, // number of draw buffers\n this._scene,\n {\n types: new Array(this._maxDrawBuffers).fill(Constants.TEXTURETYPE_UNSIGNED_BYTE),\n samplingModes: new Array(this._maxDrawBuffers).fill(Constants.TEXTURE_TRILINEAR_SAMPLINGMODE),\n generateMipMaps: false,\n targetTypes,\n formats: new Array(this._maxDrawBuffers).fill(Constants.TEXTUREFORMAT_R),\n faceIndex: new Array(this._maxDrawBuffers).fill(0),\n layerIndex: layerIndices,\n layerCounts: new Array(this._maxDrawBuffers).fill(this._voxelResolution),\n generateDepthBuffer: false,\n generateStencilBuffer: false,\n },\n textureNames\n );\n\n mrt.clearColor = new Color4(0, 0, 0, 1);\n mrt.noPrePassRenderer = true;\n for (let i = 0; i < this._maxDrawBuffers; i++) {\n mrt.setInternalTexture(voxelRT.getInternalTexture()!, i);\n }\n\n mrtArray.push(mrt);\n }\n return mrtArray;\n }\n\n private _disposeVoxelTextures() {\n this._stopVoxelization();\n for (let i = 0; i < this._voxelMrtsZaxis.length; i++) {\n if (this._triPlanarVoxelization) {\n this._voxelMrtsXaxis[i].dispose(true);\n this._voxelMrtsYaxis[i].dispose(true);\n }\n this._voxelMrtsZaxis[i].dispose(true);\n }\n if (this._triPlanarVoxelization) {\n this._voxelGridXaxis?.dispose();\n this._voxelGridYaxis?.dispose();\n this._combinedVoxelGridPT?.dispose();\n }\n this._voxelGridZaxis?.dispose();\n for (const mip of this._mipArray) {\n mip.dispose();\n }\n this._voxelMaterial?.dispose();\n this._mipArray = [];\n this._voxelMrtsXaxis = [];\n this._voxelMrtsYaxis = [];\n this._voxelMrtsZaxis = [];\n }\n\n private _createVoxelMaterials(): void {\n const isWebGPU = this._engine.isWebGPU;\n this._voxelMaterial = new ShaderMaterial(\"voxelization\", this._scene, \"iblVoxelGrid\", {\n uniforms: [\"world\", \"viewMatrix\", \"invTransWorld\", \"invWorldScale\", \"nearPlane\", \"farPlane\", \"stepSize\"],\n defines: [\"MAX_DRAW_BUFFERS \" + this._maxDrawBuffers],\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/iblVoxelGrid.fragment\"), import(\"../../ShadersWGSL/iblVoxelGrid.vertex\")]);\n } else {\n await Promise.all([import(\"../../Shaders/iblVoxelGrid.fragment\"), import(\"../../Shaders/iblVoxelGrid.vertex\")]);\n }\n },\n });\n\n this._voxelMaterial.cullBackFaces = false;\n this._voxelMaterial.backFaceCulling = false;\n this._voxelMaterial.depthFunction = Constants.ALWAYS;\n }\n\n /**\n * Checks if the voxel renderer is ready to voxelize scene\n * @returns true if the voxel renderer is ready to voxelize scene\n */\n public isReady() {\n let allReady = this.getVoxelGrid().isReady();\n for (let i = 0; i < this._mipArray.length; i++) {\n const mipReady = this._mipArray[i].isReady();\n allReady &&= mipReady;\n }\n\n if (!allReady || this._voxelizationInProgress) {\n return false;\n }\n\n return true;\n }\n\n /**\n * If the MRT's are already in the list of render targets, this will\n * remove them so that they don't get rendered again.\n */\n private _stopVoxelization() {\n // If the MRT's are already in the list of render targets, remove them.\n this._removeVoxelRTs(this._voxelMrtsXaxis);\n this._removeVoxelRTs(this._voxelMrtsYaxis);\n this._removeVoxelRTs(this._voxelMrtsZaxis);\n this._removeVoxelRTs([this._voxelGridRT]);\n }\n\n private _removeVoxelRTs(rts: RenderTargetTexture[]) {\n // const currentRTs = this._scene.customRenderTargets;\n const rtIdx = this._renderTargets.findIndex((rt) => {\n if (rt === rts[0]) {\n return true;\n }\n return false;\n });\n if (rtIdx >= 0) {\n this._renderTargets.splice(rtIdx, rts.length);\n } else {\n const rtIdx = this._scene.customRenderTargets.findIndex((rt) => {\n if (rt === rts[0]) {\n return true;\n }\n return false;\n });\n if (rtIdx >= 0) {\n this._scene.customRenderTargets.splice(rtIdx, rts.length);\n }\n }\n }\n\n /**\n * Renders voxel grid of scene for IBL shadows\n * @param includedMeshes\n * @param registerAfterRenderObservable Whether to register scene onAfterRender callback (legacy path).\n */\n public updateVoxelGrid(includedMeshes: Mesh[], registerAfterRenderObservable: boolean = true) {\n if (this._voxelizationInProgress) {\n return;\n }\n this._stopVoxelization();\n this._voxelizationInProgress = true;\n\n if (this._engine.isWebGPU) {\n this._voxelGridRT.renderList = includedMeshes;\n this._addRTsForRender([this._voxelGridRT], includedMeshes, 0);\n } else if (this._triPlanarVoxelization) {\n this._addRTsForRender(this._voxelMrtsXaxis, includedMeshes, 0);\n this._addRTsForRender(this._voxelMrtsYaxis, includedMeshes, 1);\n this._addRTsForRender(this._voxelMrtsZaxis, includedMeshes, 2);\n } else {\n this._addRTsForRender(this._voxelMrtsZaxis, includedMeshes, 2);\n }\n if (registerAfterRenderObservable) {\n this._renderVoxelGridBound = this._renderVoxelGrid.bind(this);\n this._scene.onAfterRenderObservable.add(this._renderVoxelGridBound);\n }\n }\n\n /**\n * Advances voxelization work when running in custom render loops (for example FrameGraph tasks)\n * where scene onAfterRender timing may differ from classic pipeline flow.\n */\n public processVoxelization(): void {\n this._renderVoxelGrid();\n }\n\n private _renderVoxelGridBound: () => void;\n\n private _renderVoxelGrid() {\n if (this._voxelizationInProgress) {\n // Wait for shadow-casting GaussianSplatting meshes' depth sort to settle before\n // rasterizing. Voxelization is order-independent — the order splats are drawn never\n // affects the grid — but the GS voxel draw still *indexes* each splat through the\n // `splatIndex` thin-instance buffer, and that buffer is (re)sized, filled and rebound by\n // the sort worker's callback (the same callback that flips `_isDepthSortSettled`). After\n // addPart() merges a splat, `forcedInstanceCount` jumps to the new total synchronously\n // but the index buffer is only finalized when the sort lands; rasterizing in between\n // indexes a stale/mismatched buffer and writes an empty grid (no IBL shadow until a\n // later refresh). Frame-capped so a continuously re-sorting (orbiting) splat still\n // voxelizes eventually rather than blocking forever.\n let gsSortPending = false;\n for (let i = 0; i < this._renderTargets.length && !gsSortPending; i++) {\n const renderList = this._renderTargets[i].renderList;\n if (!renderList) {\n continue;\n }\n for (const mesh of renderList) {\n if (IsGaussianSplattingClassName(mesh.getClassName()) && !(mesh as GaussianSplattingMesh)._isDepthSortSettled) {\n gsSortPending = true;\n break;\n }\n }\n }\n if (gsSortPending && this._sortSettleWaitFrames < _MaxSortSettleWaitFrames) {\n this._sortSettleWaitFrames++;\n return;\n }\n this._sortSettleWaitFrames = 0;\n\n let allReady = this.getVoxelGrid().isReady();\n for (let i = 0; i < this._mipArray.length; i++) {\n const mipReady = this._mipArray[i].isReady();\n allReady &&= mipReady;\n }\n for (let i = 0; i < this._renderTargets.length; i++) {\n const rttReady = this._renderTargets[i].isReadyForRendering();\n allReady &&= rttReady;\n }\n for (const gsVoxelMat of Array.from(this._gsVoxelMaterialCache.values())) {\n allReady &&= gsVoxelMat.isReady();\n }\n if (!allReady) {\n return;\n }\n\n const copyMipEffect = this._copyMipEffectWrapper.effect;\n if (!copyMipEffect.isReady()) {\n return;\n }\n\n if (this._engine.isWebGPU) {\n // Clear the voxel grid storage texture.\n // Need to clear each layer individually.\n // Would a compute shader be faster here to clear all layers in one go?\n if (this._voxelGrid && this._voxelGrid.renderTarget) {\n for (let layer = 0; layer < this._voxelResolution; layer++) {\n this._engine.bindFramebuffer(this._voxelGrid.renderTarget, 0, undefined, undefined, true, 0, layer);\n this._engine.clear(this._voxelClearColor, true, false, false);\n this._engine.unBindFramebuffer(this._voxelGrid.renderTarget, true);\n }\n }\n }\n\n for (const rt of this._renderTargets) {\n rt.render();\n }\n this._stopVoxelization();\n\n if (this._triPlanarVoxelization && !this._engine.isWebGPU) {\n this._combinedVoxelGridPT.render();\n }\n this._generateMipMaps();\n this._copyMipMaps();\n this._scene.onAfterRenderObservable.removeCallback(this._renderVoxelGridBound);\n this._voxelizationInProgress = false;\n this.onVoxelizationCompleteObservable.notifyObservers();\n }\n }\n\n /**\n * Splits rendering for every voxel RT: non–Gaussian splatting meshes use subMesh.render\n * (material override from setMaterialForRendering); GaussianSplattingMesh uses a custom draw path with its cached voxel ShaderMaterial.\n * @param rtt - the render target texture to install the custom render function on\n */\n private _installVoxelMixedCustomRender(rtt: RenderTargetTexture): void {\n const scene = this._scene;\n const engine = scene.getEngine();\n\n const renderGsSplat = (sm: SubMesh): void => {\n const renderingMesh = sm.getRenderingMesh();\n const effectiveMesh = sm.getEffectiveMesh();\n const gsVoxelMaterial = this._gsVoxelMaterialCache.get(effectiveMesh.uniqueId);\n if (!gsVoxelMaterial || !gsVoxelMaterial.isReady()) {\n return;\n }\n\n const drawWrapper = gsVoxelMaterial._getDrawWrapper();\n if (!drawWrapper?.effect) {\n return;\n }\n const effect = drawWrapper.effect;\n\n const batch = renderingMesh._getInstancesRenderList(sm._id, !!sm.getReplacementMesh());\n if (batch.mustReturn) {\n return;\n }\n\n const hardwareInstancedRendering =\n engine.getCaps().instancedArrays && ((batch.visibleInstances[sm._id] !== null && batch.visibleInstances[sm._id] !== undefined) || renderingMesh.hasThinInstances);\n\n const fillMode = sm.getMaterial()?.fillMode ?? Constants.MATERIAL_TriangleFillMode;\n engine.enableEffect(drawWrapper);\n renderingMesh._bind(sm, effect, fillMode);\n gsVoxelMaterial._preBind(drawWrapper);\n gsVoxelMaterial.bind(effectiveMesh.getWorldMatrix(), effectiveMesh, effect);\n // If rotation/scale textures are missing, bind() logged the warning; skip the draw to avoid GPU errors.\n if (!(effectiveMesh as GaussianSplattingMesh).rotationsATexture) {\n gsVoxelMaterial.unbind();\n return;\n }\n if (engine.isWebGPU) {\n // A GSplat is a 3D Gaussian ellipsoid. To approximate its volume in the voxel grid\n // we rasterize three planar cross-section quads — one per principal axis — each\n // spanning the ellipsoid cross-section perpendicular to that axis. A quad rendered\n // edge-on produces zero fragments, so we draw once per world axis: each draw lets\n // computeVoxelSplatWorldPos pick the quad whose normal best aligns with that view,\n // guaranteeing every splat is captured face-on from at least one direction.\n const viewMatrices = _IblShadowsVoxelRenderer._VOXEL_VIEW_MATRICES;\n for (let axisIdx = 0; axisIdx < 3; axisIdx++) {\n effect.setMatrix(\"viewMatrix\", viewMatrices[axisIdx]);\n renderingMesh._processRendering(effectiveMesh, sm, effect, fillMode, batch, hardwareInstancedRendering, (_isInstance, world) => {\n effect.setMatrix(\"world\", world);\n });\n }\n } else {\n renderingMesh._processRendering(effectiveMesh, sm, effect, fillMode, batch, hardwareInstancedRendering, (_isInstance, world) => effect.setMatrix(\"world\", world));\n }\n gsVoxelMaterial.unbind();\n };\n\n const processBucket = (subMeshes: SmartArray<SubMesh>, enableAlphaMode: boolean): void => {\n for (let i = 0; i < subMeshes.length; i++) {\n const sm = subMeshes.data[i];\n const effective = sm.getEffectiveMesh();\n if (IsGaussianSplattingClassName(effective.getClassName())) {\n renderGsSplat(sm);\n } else {\n sm.render(enableAlphaMode);\n }\n }\n };\n\n rtt.customRenderFunction = (\n opaqueSubMeshes: SmartArray<SubMesh>,\n alphaTestSubMeshes: SmartArray<SubMesh>,\n transparentSubMeshes: SmartArray<SubMesh>,\n depthOnlySubMeshes: SmartArray<SubMesh>\n ): void => {\n if (depthOnlySubMeshes.length) {\n engine.setColorWrite(false);\n processBucket(depthOnlySubMeshes, false);\n engine.setColorWrite(true);\n }\n processBucket(opaqueSubMeshes, false);\n processBucket(alphaTestSubMeshes, false);\n processBucket(transparentSubMeshes, true);\n };\n }\n\n private _addGsMeshToVoxelRT(mrt: RenderTargetTexture, mesh: GaussianSplattingMesh): void {\n let gsVoxelMaterial = this._gsVoxelMaterialCache.get(mesh.uniqueId);\n if (!gsVoxelMaterial) {\n const gsMaterial = mesh.material as GaussianSplattingMaterial;\n if (!gsMaterial) {\n return;\n }\n const shaderLanguage = this._engine.isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL;\n gsVoxelMaterial = gsMaterial.makeVoxelRenderingMaterial(this._scene, shaderLanguage, this._maxDrawBuffers, mesh.isCompound);\n this._gsVoxelMaterialCache.set(mesh.uniqueId, gsVoxelMaterial);\n }\n mrt.renderList?.push(mesh as Mesh);\n mrt.setMaterialForRendering(mesh as Mesh, gsVoxelMaterial);\n }\n\n private _addRTsForRender(mrts: RenderTargetTexture[], includedMeshes: Mesh[], axis: number) {\n const slabSize = 1.0 / this._computeNumberOfSlabs();\n const voxelMaterial = this._voxelMaterial;\n\n // We need to update the world scale uniform for every mesh being rendered to the voxel grid.\n for (let mrtIndex = 0; mrtIndex < mrts.length; mrtIndex++) {\n const mrt = mrts[mrtIndex];\n mrt._disableEngineStages = true;\n mrt.useCameraPostProcesses = false;\n mrt.renderParticles = false;\n mrt.renderSprites = false;\n mrt.enableOutlineRendering = false;\n\n const renderBucket = (bucket: SmartArray<SubMesh>) => {\n for (let index = 0; index < bucket.length; index++) {\n const subMesh = bucket.data[index];\n if (subMesh.getMaterial() !== voxelMaterial) {\n continue;\n }\n subMesh.render(false);\n }\n };\n\n mrt.customRenderFunction = (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) => {\n renderBucket(depthOnlySubMeshes);\n renderBucket(opaqueSubMeshes);\n renderBucket(alphaTestSubMeshes);\n renderBucket(transparentSubMeshes);\n };\n\n mrt.renderList = [];\n const nearPlane = mrtIndex * slabSize;\n const farPlane = (mrtIndex + 1) * slabSize;\n const stepSize = slabSize / this._maxDrawBuffers;\n\n const viewMatrix = _IblShadowsVoxelRenderer._VOXEL_VIEW_MATRICES[axis];\n mrt.onBeforeRenderObservable.clear();\n mrt.onBeforeRenderObservable.add(() => {\n voxelMaterial.setMatrix(\"viewMatrix\", viewMatrix);\n voxelMaterial.setMatrix(\"invWorldScale\", this._invWorldScaleMatrix);\n voxelMaterial.setFloat(\"nearPlane\", nearPlane);\n voxelMaterial.setFloat(\"farPlane\", farPlane);\n voxelMaterial.setFloat(\"stepSize\", stepSize);\n if (this._engine.isWebGPU) {\n this._voxelMaterial.useVertexPulling = true;\n this._voxelMaterial.setTexture(\"voxel_storage\", this.getVoxelGrid());\n }\n // Push per-slab uniforms to each GS voxel material in this MRT's render list.\n for (const m of mrt.renderList ?? []) {\n if (IsGaussianSplattingClassName(m.getClassName())) {\n const gsVoxelMat = this._gsVoxelMaterialCache.get(m.uniqueId);\n if (gsVoxelMat) {\n gsVoxelMat.setMatrix(\"invWorldScale\", this._invWorldScaleMatrix);\n if (this._engine.isWebGPU) {\n // WGSL GS voxel shader uses the same viewMatrix approach as WebGL; the per-axis viewMatrix is set per-draw in renderGsSplat.\n gsVoxelMat.setTexture(\"voxel_storage\", this.getVoxelGrid());\n } else {\n gsVoxelMat.setMatrix(\"viewMatrix\", viewMatrix);\n gsVoxelMat.setFloat(\"nearPlane\", nearPlane);\n gsVoxelMat.setFloat(\"farPlane\", farPlane);\n gsVoxelMat.setFloat(\"stepSize\", stepSize);\n }\n }\n }\n }\n });\n\n // Set this material on every mesh in the scene (for this RT)\n if (includedMeshes.length === 0) {\n return;\n }\n for (const mesh of includedMeshes) {\n if (!mesh) {\n continue;\n }\n if (IsGaussianSplattingClassName(mesh.getClassName())) {\n this._addGsMeshToVoxelRT(mrt, mesh as GaussianSplattingMesh);\n } else if (mesh.subMeshes && mesh.subMeshes.length > 0) {\n mrt.renderList?.push(mesh);\n mrt.setMaterialForRendering(mesh, voxelMaterial);\n }\n const meshes = mesh.getChildMeshes();\n for (const childMesh of meshes) {\n if (IsGaussianSplattingClassName(childMesh.getClassName())) {\n this._addGsMeshToVoxelRT(mrt, childMesh as GaussianSplattingMesh);\n } else if (childMesh.subMeshes && childMesh.subMeshes.length > 0) {\n mrt.renderList?.push(childMesh);\n mrt.setMaterialForRendering(childMesh, voxelMaterial);\n }\n }\n }\n\n this._installVoxelMixedCustomRender(mrt);\n }\n\n this._renderTargets = this._renderTargets.concat(mrts);\n }\n\n /**\n * Called by the pipeline to resize resources.\n */\n public resize() {}\n\n /**\n * Disposes the voxel renderer and associated resources\n */\n public dispose() {\n this._disposeVoxelTextures();\n for (const mat of Array.from(this._gsVoxelMaterialCache.values())) {\n mat.dispose();\n }\n this._gsVoxelMaterialCache.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"iblShadowsVoxelRenderer.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.ts"],"names":[],"mappings":"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only contain pure code and pure imports */\n\nimport { Constants } from \"../../Engines/constants\";\nimport { type Engine } from \"../../Engines/engine.pure\";\nimport { ShaderMaterial } from \"../../Materials/shaderMaterial.pure\";\nimport { MultiRenderTarget } from \"../../Materials/Textures/multiRenderTarget.pure\";\nimport { RenderTargetTexture, type RenderTargetTextureOptions } from \"../../Materials/Textures/renderTargetTexture.pure\";\nimport { type TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\nimport { Color4 } from \"../../Maths/math.color.pure\";\nimport { Matrix, Vector3 } from \"../../Maths/math.vector.pure\";\nimport { type Mesh } from \"../../Meshes/mesh.pure\";\nimport { type SubMesh } from \"../../Meshes/subMesh.pure\";\nimport { type Scene } from \"../../scene.pure\";\nimport { type SmartArray } from \"../../Misc/smartArray\";\nimport { Texture } from \"../../Materials/Textures/texture.pure\";\nimport { Logger } from \"../../Misc/logger\";\nimport { Observable } from \"../../Misc/observable.pure\";\nimport { ProceduralTexture, type IProceduralTextureCreationOptions } from \"../../Materials/Textures/Procedurals/proceduralTexture.pure\";\nimport { EffectRenderer, EffectWrapper } from \"../../Materials/effectRenderer.pure\";\nimport { StorageBuffer } from \"../../Buffers/storageBuffer\";\nimport { ComputeShader } from \"../../Compute/computeShader.pure\";\nimport { type WebGPUEngine } from \"../../Engines/webgpuEngine.pure\";\nimport { type IblShadowsRenderPipeline } from \"./iblShadowsRenderPipeline.pure\";\nimport { type RenderTargetWrapper } from \"core/Engines/renderTargetWrapper\";\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\nimport { type GaussianSplattingMesh, IsGaussianSplattingClassName } from \"../../Meshes/GaussianSplatting/gaussianSplattingMesh.pure\";\nimport { type GaussianSplattingMaterial } from \"../../Materials/GaussianSplatting/gaussianSplattingMaterial.pure\";\n\n// Max frames _renderVoxelGrid waits for splat depth sorts to settle before voxelizing anyway\n// (~3s at 60fps). Bounds the wait so a continuously re-sorting (orbiting) splat can't block it.\nconst _MaxSortSettleWaitFrames = 180;\n\n/**\n * Returns true if any of the given meshes (or their children) is a Gaussian splatting mesh.\n * Used to decide whether WebGPU voxelization needs the opacity accumulator buffer + copy pass.\n * @param meshes meshes included in the voxelization\n * @returns whether any included mesh (or child) is a Gaussian splatting mesh\n */\nfunction _HasGaussianSplatting(meshes: Mesh[]): boolean {\n for (const mesh of meshes) {\n if (!mesh) {\n continue;\n }\n if (IsGaussianSplattingClassName(mesh.getClassName())) {\n return true;\n }\n for (const child of mesh.getChildMeshes()) {\n if (IsGaussianSplattingClassName(child.getClassName())) {\n return true;\n }\n }\n }\n return false;\n}\n\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 * @internal\n * @see https://playground.babylonjs.com/#8R5SSE#222\n */\nexport class _IblShadowsVoxelRenderer {\n // View matrices for the three voxelization axes.\n private static readonly _VOXEL_VIEW_MATRICES = [\n Matrix.LookAtLH(Vector3.Zero(), new Vector3(1, 0, 0), Vector3.Up()),\n Matrix.LookAtLH(Vector3.Zero(), new Vector3(0, 1, 0), new Vector3(1, 0, 0)),\n Matrix.LookAtLH(Vector3.Zero(), new Vector3(0, 0, 1), Vector3.Up()),\n ];\n\n private _scene: Scene;\n private _engine: Engine;\n\n // WebGPU, single-pass voxelization.\n // See https://playground.babylonjs.com/#XSNYAU#133\n private _voxelGrid: RenderTargetTexture;\n private _voxelGridRT: RenderTargetTexture;\n\n // WebGL voxelization, including tri-planar voxelization.\n private _combinedVoxelGridPT: ProceduralTexture;\n private _voxelGridXaxis: RenderTargetTexture;\n private _voxelGridYaxis: RenderTargetTexture;\n private _voxelGridZaxis: RenderTargetTexture;\n private _voxelMrtsXaxis: MultiRenderTarget[] = [];\n private _voxelMrtsYaxis: MultiRenderTarget[] = [];\n private _voxelMrtsZaxis: MultiRenderTarget[] = [];\n\n private _voxelMaterial: ShaderMaterial;\n\n // WebGPU only: per-voxel opacity accumulator (atomicMax during voxelization, copied to the r8 grid\n // mip 0 by _copyBufferToGridCompute). Used only when Gaussian splats are present; regular-mesh-only\n // voxelization writes the grid directly and skips it.\n private _voxelOpacityBuffer?: StorageBuffer;\n private _copyBufferToGridCompute?: ComputeShader;\n private _useOpacityBuffer = false;\n private _voxelClearColor: Color4 = new Color4(0, 0, 0, 1);\n\n /**\n * Return the voxel grid texture.\n * @returns The voxel grid texture.\n */\n public getVoxelGrid(): ProceduralTexture | RenderTargetTexture {\n if (this._engine.isWebGPU) {\n return this._voxelGrid;\n } else if (this._triPlanarVoxelization) {\n return this._combinedVoxelGridPT;\n } else {\n return this._voxelGridZaxis;\n }\n }\n\n /**\n * Return the voxel render target used during voxelization.\n * @returns The voxel render target.\n */\n public getRT(): ProceduralTexture | RenderTargetTexture {\n if (this._engine.isWebGPU) {\n return this._voxelGridRT;\n } else if (this._triPlanarVoxelization) {\n return this._combinedVoxelGridPT;\n } else {\n return this._voxelGridZaxis;\n }\n }\n\n /**\n * Observable that triggers when the voxelization is complete\n */\n public onVoxelizationCompleteObservable: Observable<void> = new Observable<void>();\n\n private _maxDrawBuffers: number;\n private _renderTargets: RenderTargetTexture[] = [];\n\n /** Per-mesh voxel ShaderMaterials for GaussianSplattingMesh, keyed by mesh uniqueId. */\n private _gsVoxelMaterialCache: Map<number, ShaderMaterial> = new Map();\n\n private _triPlanarVoxelization: boolean = true;\n\n /**\n * Whether to use tri-planar voxelization. More expensive, but can help with artifacts.\n */\n public get triPlanarVoxelization(): boolean {\n return this._triPlanarVoxelization;\n }\n\n /**\n * Whether to use tri-planar voxelization. More expensive, but can help with artifacts.\n */\n public set triPlanarVoxelization(enabled: boolean) {\n if (this._engine.isWebGPU) {\n // WebGPU only supports tri-planar voxelization.\n this._triPlanarVoxelization = true;\n return;\n }\n if (this._triPlanarVoxelization === enabled) {\n return;\n }\n this._disposeVoxelTextures();\n this._triPlanarVoxelization = enabled;\n this._createTextures();\n }\n\n private _voxelizationInProgress: boolean = false;\n // Frames spent waiting for shadow-casting splats' depth sort to settle before voxelizing; see\n // _renderVoxelGrid. Capped so a continuously re-sorting (e.g. orbiting) splat can't starve it.\n private _sortSettleWaitFrames: number = 0;\n private _invWorldScaleMatrix: Matrix = Matrix.Identity();\n\n /**\n * Set the matrix to use for scaling the world space to voxel space\n * @param matrix The matrix to use for scaling the world space to voxel space\n */\n public setWorldScaleMatrix(matrix: Matrix) {\n this._invWorldScaleMatrix = matrix;\n }\n\n /**\n * @returns Whether voxelization is currently happening.\n */\n public isVoxelizationInProgress(): boolean {\n return this._voxelizationInProgress;\n }\n\n private _voxelResolution: number = 64;\n private _voxelResolutionExp: number = 6;\n\n /**\n * Resolution of the voxel grid. The final resolution will be 2^resolutionExp.\n */\n public get voxelResolutionExp(): number {\n return this._voxelResolutionExp;\n }\n\n /**\n * Resolution of the voxel grid. The final resolution will be 2^resolutionExp.\n */\n public set voxelResolutionExp(resolutionExp: number) {\n if (this._voxelResolutionExp === resolutionExp && this._voxelGridZaxis) {\n return;\n }\n this._voxelResolutionExp = Math.round(Math.min(Math.max(resolutionExp, 3), 9));\n this._voxelResolution = Math.pow(2.0, this._voxelResolutionExp);\n this._disposeVoxelTextures();\n this._createTextures();\n }\n\n private _copyMipEffectRenderer: EffectRenderer;\n private _copyMipEffectWrapper: EffectWrapper;\n private _copyMipSourceTexture?: ProceduralTexture;\n private _copyMipLayer = 0;\n private _mipArray: ProceduralTexture[] = [];\n\n /**\n * Instanciates the voxel renderer\n * @param scene Scene to attach to\n * @param iblShadowsRenderPipeline The render pipeline this pass is associated with\n * @param resolutionExp Resolution of the voxel grid. The final resolution will be 2^resolutionExp.\n * @param triPlanarVoxelization Whether to use tri-planar voxelization. Only applies to WebGL. Voxelization will take longer but will reduce missing geometry.\n * @returns The voxel renderer\n */\n constructor(scene: Scene, iblShadowsRenderPipeline: IblShadowsRenderPipeline, resolutionExp: number = 6, triPlanarVoxelization: boolean = true) {\n this._scene = scene;\n this._engine = scene.getEngine() as Engine;\n this._triPlanarVoxelization = this._engine.isWebGPU || triPlanarVoxelization;\n if (!this._engine.getCaps().drawBuffersExtension) {\n Logger.Error(\"Can't do voxel rendering without the draw buffers extension.\");\n }\n\n const isWebGPU = this._engine.isWebGPU;\n // Round down to a power of 2 so it evenly divides the power-of-2 voxel resolution,\n // preventing out-of-bounds layer indices in the last MRT slab.\n // This shader implementation writes up to 16 MRT outputs, so clamp to 16 to keep\n // active draw buffers aligned with declared/written fragment outputs.\n const rawMaxDrawBuffers = this._engine.getCaps().maxDrawBuffers || 0;\n const cappedMaxDrawBuffers = Math.min(rawMaxDrawBuffers, 16);\n this._maxDrawBuffers = cappedMaxDrawBuffers >= 1 ? 1 << Math.floor(Math.log2(cappedMaxDrawBuffers)) : 0;\n\n this._copyMipEffectRenderer = new EffectRenderer(this._engine);\n this._copyMipEffectWrapper = new EffectWrapper({\n engine: this._engine,\n fragmentShader: \"copyTexture3DLayerToTexture\",\n useShaderStore: true,\n uniformNames: [\"layerNum\"],\n samplerNames: [\"textureSampler\"],\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await import(\"../../ShadersWGSL/copyTexture3DLayerToTexture.fragment\");\n } else {\n await import(\"../../Shaders/copyTexture3DLayerToTexture.fragment\");\n }\n },\n });\n this._copyMipEffectWrapper.onApplyObservable.add(() => {\n const effect = this._copyMipEffectWrapper.effect;\n if (!effect || !this._copyMipSourceTexture) {\n return;\n }\n\n effect.setTexture(\"textureSampler\", this._copyMipSourceTexture);\n effect.setInt(\"layerNum\", this._copyMipLayer);\n });\n\n this.voxelResolutionExp = resolutionExp;\n }\n\n private _generateMipMaps() {\n const iterations = Math.ceil(Math.log2(this._voxelResolution));\n for (let i = 1; i < iterations + 1; i++) {\n this._generateMipMap(i);\n }\n }\n\n private _generateMipMap(lodLevel: number) {\n // Generate a mip map for the given level by triggering the render of the procedural mip texture.\n const mipTarget = this._mipArray[lodLevel - 1];\n if (!mipTarget) {\n return;\n }\n\n mipTarget.setTexture(\"srcMip\", lodLevel === 1 ? this.getVoxelGrid() : this._mipArray[lodLevel - 2]);\n mipTarget.render();\n }\n\n private _copyMipMaps() {\n const iterations = Math.ceil(Math.log2(this._voxelResolution));\n for (let i = 1; i < iterations + 1; i++) {\n this._copyMipMap(i);\n }\n }\n\n private _copyMipMap(lodLevel: number) {\n // Now, copy this mip into the mip chain of the voxel grid.\n const mipTarget = this._mipArray[lodLevel - 1];\n if (!mipTarget) {\n return;\n }\n const voxelGrid = this.getVoxelGrid();\n let rt: RenderTargetWrapper;\n if (voxelGrid instanceof RenderTargetTexture && voxelGrid.renderTarget) {\n rt = voxelGrid.renderTarget;\n } else {\n rt = (voxelGrid as any)._rtWrapper;\n }\n if (rt) {\n this._copyMipEffectRenderer.saveStates();\n const previousColorWrite = this._engine.getColorWrite();\n const previousDepthBuffer = this._engine.getDepthBuffer();\n const previousDepthWrite = this._engine.getDepthWrite();\n const previousAlphaMode = this._engine.getAlphaMode();\n this._engine.setColorWrite(true);\n this._engine.setDepthBuffer(false);\n this._engine.setDepthWrite(false);\n this._engine.setAlphaMode(Constants.ALPHA_DISABLE);\n const bindSize = mipTarget.getSize().width;\n let sourceDepth = mipTarget.getInternalTexture()?.depth;\n sourceDepth = Math.max(1, sourceDepth || bindSize);\n const destinationMipDepth = Math.max(1, this._voxelResolution >> lodLevel);\n const layersToCopy = Math.min(sourceDepth, destinationMipDepth);\n const destinationTexture = rt.texture;\n const previousGenerateMipMaps = destinationTexture?.generateMipMaps;\n\n if (destinationTexture) {\n destinationTexture.generateMipMaps = false;\n }\n\n try {\n // Render to each layer of the voxel grid.\n for (let layer = 0; layer < layersToCopy; layer++) {\n this._engine.bindFramebuffer(rt, 0, bindSize, bindSize, true, lodLevel, layer);\n this._copyMipSourceTexture = mipTarget;\n this._copyMipLayer = layer;\n this._copyMipEffectRenderer.applyEffectWrapper(this._copyMipEffectWrapper);\n this._copyMipEffectRenderer.draw();\n this._engine.unBindFramebuffer(rt, true);\n }\n\n if (!this._engine.isWebGPU) {\n this._engine.unbindAllTextures();\n }\n } finally {\n if (destinationTexture && previousGenerateMipMaps !== undefined) {\n destinationTexture.generateMipMaps = previousGenerateMipMaps;\n }\n this._engine.setAlphaMode(previousAlphaMode);\n this._engine.setDepthWrite(previousDepthWrite);\n this._engine.setDepthBuffer(previousDepthBuffer);\n this._engine.setColorWrite(previousColorWrite);\n }\n\n this._copyMipSourceTexture = undefined;\n this._copyMipEffectRenderer.restoreStates();\n }\n }\n\n private _computeNumberOfSlabs(): number {\n return Math.ceil(this._voxelResolution / this._maxDrawBuffers);\n }\n\n private _createTextures() {\n const isWebGPU = this._engine.isWebGPU;\n const size: TextureSize = {\n width: this._voxelResolution,\n height: this._voxelResolution,\n depth: this._voxelResolution,\n };\n const voxelAxisOptions: RenderTargetTextureOptions = {\n generateDepthBuffer: false,\n generateMipMaps: false,\n type: Constants.TEXTURETYPE_UNSIGNED_BYTE,\n format: Constants.TEXTUREFORMAT_R,\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n };\n\n // We can render up to maxDrawBuffers voxel slices of the grid per render.\n // We call this a slab.\n const numSlabs = this._computeNumberOfSlabs();\n const voxelCombinedOptions: IProceduralTextureCreationOptions = {\n generateDepthBuffer: false,\n generateMipMaps: true,\n type: Constants.TEXTURETYPE_UNSIGNED_BYTE,\n format: Constants.TEXTUREFORMAT_R,\n samplingMode: Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST,\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await import(\"../../ShadersWGSL/iblCombineVoxelGrids.fragment\");\n } else {\n await import(\"../../Shaders/iblCombineVoxelGrids.fragment\");\n }\n },\n };\n if (this._engine.isWebGPU) {\n this._voxelGrid = new RenderTargetTexture(\"voxelGrid\", size, this._scene, {\n ...voxelCombinedOptions,\n format: Constants.TEXTUREFORMAT_R,\n creationFlags: Constants.TEXTURE_CREATIONFLAG_STORAGE,\n });\n this._voxelGridRT = new RenderTargetTexture(\n \"voxelGridRT\",\n { width: Math.min(size.width * 2.0, 2048), height: Math.min(size.height * 2.0, 2048) },\n this._scene,\n voxelAxisOptions\n );\n // The opacity accumulator is created lazily, only when a voxelization includes Gaussian\n // splats (see _ensureVoxelOpacityAccumulator).\n } else if (this._triPlanarVoxelization) {\n this._voxelGridXaxis = new RenderTargetTexture(\"voxelGridXaxis\", size, this._scene, voxelAxisOptions);\n this._voxelGridYaxis = new RenderTargetTexture(\"voxelGridYaxis\", size, this._scene, voxelAxisOptions);\n this._voxelGridZaxis = new RenderTargetTexture(\"voxelGridZaxis\", size, this._scene, voxelAxisOptions);\n this._voxelMrtsXaxis = this._createVoxelMRTs(\"x_axis_\", this._voxelGridXaxis, numSlabs);\n this._voxelMrtsYaxis = this._createVoxelMRTs(\"y_axis_\", this._voxelGridYaxis, numSlabs);\n this._voxelMrtsZaxis = this._createVoxelMRTs(\"z_axis_\", this._voxelGridZaxis, numSlabs);\n\n this._combinedVoxelGridPT = new ProceduralTexture(\"combinedVoxelGrid\", size, \"iblCombineVoxelGrids\", this._scene, voxelCombinedOptions, false);\n this._scene.proceduralTextures.splice(this._scene.proceduralTextures.indexOf(this._combinedVoxelGridPT), 1);\n this._combinedVoxelGridPT.setFloat(\"layer\", 0.0);\n this._combinedVoxelGridPT.setTexture(\"voxelXaxisSampler\", this._voxelGridXaxis);\n this._combinedVoxelGridPT.setTexture(\"voxelYaxisSampler\", this._voxelGridYaxis);\n this._combinedVoxelGridPT.setTexture(\"voxelZaxisSampler\", this._voxelGridZaxis);\n // We will render this only after voxelization is completed for the 3 axes.\n this._combinedVoxelGridPT.autoClear = false;\n this._combinedVoxelGridPT.wrapU = Texture.CLAMP_ADDRESSMODE;\n this._combinedVoxelGridPT.wrapV = Texture.CLAMP_ADDRESSMODE;\n this._combinedVoxelGridPT.wrapR = Texture.CLAMP_ADDRESSMODE;\n } else {\n this._voxelGridZaxis = new RenderTargetTexture(\"voxelGridZaxis\", size, this._scene, voxelCombinedOptions);\n this._voxelMrtsZaxis = this._createVoxelMRTs(\"z_axis_\", this._voxelGridZaxis, numSlabs);\n }\n\n const generateVoxelMipOptions: IProceduralTextureCreationOptions = {\n generateDepthBuffer: false,\n generateMipMaps: false,\n type: Constants.TEXTURETYPE_UNSIGNED_BYTE,\n format: Constants.TEXTUREFORMAT_R,\n samplingMode: Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await import(\"../../ShadersWGSL/iblGenerateVoxelMip.fragment\");\n } else {\n await import(\"../../Shaders/iblGenerateVoxelMip.fragment\");\n }\n },\n };\n this._mipArray = new Array(Math.ceil(Math.log2(this._voxelResolution)));\n for (let mipIdx = 1; mipIdx <= this._mipArray.length; mipIdx++) {\n const mipDim = this._voxelResolution >> mipIdx;\n const mipSize: TextureSize = { width: mipDim, height: mipDim, depth: mipDim };\n this._mipArray[mipIdx - 1] = new ProceduralTexture(\"voxelMip\" + mipIdx, mipSize, \"iblGenerateVoxelMip\", this._scene, generateVoxelMipOptions, false);\n this._scene.proceduralTextures.splice(this._scene.proceduralTextures.indexOf(this._mipArray[mipIdx - 1]), 1);\n\n const mipTarget = this._mipArray[mipIdx - 1];\n mipTarget.autoClear = false;\n mipTarget.wrapU = Texture.CLAMP_ADDRESSMODE;\n mipTarget.wrapV = Texture.CLAMP_ADDRESSMODE;\n mipTarget.wrapR = Texture.CLAMP_ADDRESSMODE;\n mipTarget.setTexture(\"srcMip\", mipIdx > 1 ? this._mipArray[mipIdx - 2] : this.getVoxelGrid());\n mipTarget.setInt(\"layerNum\", 0);\n }\n\n this._createVoxelMaterials();\n }\n\n /**\n * WebGPU only. Allocates the opacity accumulator buffer and the compute shader that copies it into\n * the r8 grid. Storage textures can't blend or do float atomics, so splats accumulate via atomicMax\n * and this compute pass decodes the result into mip 0.\n */\n private _ensureVoxelOpacityAccumulator(): void {\n if (this._voxelOpacityBuffer) {\n return;\n }\n const res = this._voxelResolution;\n // Packed 4 voxels/u32, so res^3 bytes. res is a power of two >= 8, so res^3 is a multiple of 4.\n this._voxelOpacityBuffer = new StorageBuffer(this._engine as unknown as WebGPUEngine, res * res * res);\n void (async () => {\n await import(\"../../ShadersWGSL/iblCopyVoxelBufferToGrid.compute\");\n this._copyBufferToGridCompute = new ComputeShader(\"iblCopyVoxelBufferToGrid\", this._engine, \"iblCopyVoxelBufferToGrid\", {\n bindingsMapping: {\n voxelOpacityBuffer: { group: 0, binding: 0 },\n voxelGridTarget: { group: 0, binding: 1 },\n },\n });\n })();\n }\n\n /**\n * WebGPU only. Dispatches the compute pass that decodes the per-voxel opacity accumulator buffer\n * into the r8 voxel grid (mip 0). Runs after all voxelization passes and before mip generation.\n */\n private _copyVoxelOpacityBufferToGrid(): void {\n const compute = this._copyBufferToGridCompute;\n if (!compute || !this._voxelOpacityBuffer) {\n return;\n }\n compute.setStorageBuffer(\"voxelOpacityBuffer\", this._voxelOpacityBuffer);\n compute.setStorageTexture(\"voxelGridTarget\", this._voxelGrid);\n // Workgroup size is 4x4x4; cover the whole grid.\n const groups = Math.ceil(this._voxelResolution / 4);\n compute.dispatch(groups, groups, groups);\n }\n\n private _createVoxelMRTs(name: string, voxelRT: RenderTargetTexture, numSlabs: number): MultiRenderTarget[] {\n voxelRT.wrapU = Texture.CLAMP_ADDRESSMODE;\n voxelRT.wrapV = Texture.CLAMP_ADDRESSMODE;\n // 3D texture: clamp the depth (R) axis too. The combine shader samples each grid with the depth\n // coordinate spanning [0,1], so without this it wraps to the opposite face at the boundaries.\n voxelRT.wrapR = Texture.CLAMP_ADDRESSMODE;\n voxelRT.noPrePassRenderer = true;\n const mrtArray: MultiRenderTarget[] = [];\n const targetTypes = new Array(this._maxDrawBuffers).fill(Constants.TEXTURE_3D);\n\n for (let mrtIndex = 0; mrtIndex < numSlabs; mrtIndex++) {\n let layerIndices = new Array(this._maxDrawBuffers).fill(0);\n layerIndices = layerIndices.map((value, index) => mrtIndex * this._maxDrawBuffers + index);\n\n let textureNames = new Array(this._maxDrawBuffers).fill(\"\");\n textureNames = textureNames.map((value, index) => \"voxel_grid_\" + name + (mrtIndex * this._maxDrawBuffers + index));\n\n const mrt = new MultiRenderTarget(\n \"mrt_\" + name + mrtIndex,\n { width: this._voxelResolution, height: this._voxelResolution, depth: this._voxelResolution },\n this._maxDrawBuffers, // number of draw buffers\n this._scene,\n {\n types: new Array(this._maxDrawBuffers).fill(Constants.TEXTURETYPE_UNSIGNED_BYTE),\n samplingModes: new Array(this._maxDrawBuffers).fill(Constants.TEXTURE_TRILINEAR_SAMPLINGMODE),\n generateMipMaps: false,\n targetTypes,\n formats: new Array(this._maxDrawBuffers).fill(Constants.TEXTUREFORMAT_R),\n faceIndex: new Array(this._maxDrawBuffers).fill(0),\n layerIndex: layerIndices,\n layerCounts: new Array(this._maxDrawBuffers).fill(this._voxelResolution),\n generateDepthBuffer: false,\n generateStencilBuffer: false,\n },\n textureNames\n );\n\n mrt.clearColor = new Color4(0, 0, 0, 1);\n mrt.noPrePassRenderer = true;\n for (let i = 0; i < this._maxDrawBuffers; i++) {\n mrt.setInternalTexture(voxelRT.getInternalTexture()!, i);\n }\n\n mrtArray.push(mrt);\n }\n return mrtArray;\n }\n\n private _disposeVoxelTextures() {\n this._stopVoxelization();\n for (let i = 0; i < this._voxelMrtsZaxis.length; i++) {\n if (this._triPlanarVoxelization) {\n this._voxelMrtsXaxis[i].dispose(true);\n this._voxelMrtsYaxis[i].dispose(true);\n }\n this._voxelMrtsZaxis[i].dispose(true);\n }\n if (this._triPlanarVoxelization) {\n this._voxelGridXaxis?.dispose();\n this._voxelGridYaxis?.dispose();\n this._combinedVoxelGridPT?.dispose();\n }\n this._voxelGridZaxis?.dispose();\n for (const mip of this._mipArray) {\n mip.dispose();\n }\n this._voxelMaterial?.dispose();\n this._voxelOpacityBuffer?.dispose();\n this._voxelOpacityBuffer = undefined;\n this._copyBufferToGridCompute = undefined;\n // The recreated _voxelMaterial has no IBL_VOXEL_OPACITY_BUFFER define; reset the flag so\n // updateVoxelGrid re-adds it (its change check would otherwise skip it after a resolution change).\n this._useOpacityBuffer = false;\n this._mipArray = [];\n this._voxelMrtsXaxis = [];\n this._voxelMrtsYaxis = [];\n this._voxelMrtsZaxis = [];\n }\n\n private _createVoxelMaterials(): void {\n const isWebGPU = this._engine.isWebGPU;\n this._voxelMaterial = new ShaderMaterial(\"voxelization\", this._scene, \"iblVoxelGrid\", {\n uniforms: [\"world\", \"viewMatrix\", \"invTransWorld\", \"invWorldScale\", \"nearPlane\", \"farPlane\", \"stepSize\"],\n // WebGPU accumulates non-binary voxel opacity via atomicMax into this storage buffer.\n storageBuffers: isWebGPU ? [\"voxelOpacityBuffer\"] : [],\n defines: [\"MAX_DRAW_BUFFERS \" + this._maxDrawBuffers],\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/iblVoxelGrid.fragment\"), import(\"../../ShadersWGSL/iblVoxelGrid.vertex\")]);\n } else {\n await Promise.all([import(\"../../Shaders/iblVoxelGrid.fragment\"), import(\"../../Shaders/iblVoxelGrid.vertex\")]);\n }\n },\n });\n\n this._voxelMaterial.cullBackFaces = false;\n this._voxelMaterial.backFaceCulling = false;\n this._voxelMaterial.depthFunction = Constants.ALWAYS;\n }\n\n /**\n * Checks if the voxel renderer is ready to voxelize scene\n * @returns true if the voxel renderer is ready to voxelize scene\n */\n public isReady() {\n let allReady = this.getVoxelGrid().isReady();\n for (let i = 0; i < this._mipArray.length; i++) {\n const mipReady = this._mipArray[i].isReady();\n allReady &&= mipReady;\n }\n\n if (!allReady || this._voxelizationInProgress) {\n return false;\n }\n\n return true;\n }\n\n /**\n * If the MRT's are already in the list of render targets, this will\n * remove them so that they don't get rendered again.\n */\n private _stopVoxelization() {\n // If the MRT's are already in the list of render targets, remove them.\n this._removeVoxelRTs(this._voxelMrtsXaxis);\n this._removeVoxelRTs(this._voxelMrtsYaxis);\n this._removeVoxelRTs(this._voxelMrtsZaxis);\n this._removeVoxelRTs([this._voxelGridRT]);\n }\n\n private _removeVoxelRTs(rts: RenderTargetTexture[]) {\n // const currentRTs = this._scene.customRenderTargets;\n const rtIdx = this._renderTargets.findIndex((rt) => {\n if (rt === rts[0]) {\n return true;\n }\n return false;\n });\n if (rtIdx >= 0) {\n this._renderTargets.splice(rtIdx, rts.length);\n } else {\n const rtIdx = this._scene.customRenderTargets.findIndex((rt) => {\n if (rt === rts[0]) {\n return true;\n }\n return false;\n });\n if (rtIdx >= 0) {\n this._scene.customRenderTargets.splice(rtIdx, rts.length);\n }\n }\n }\n\n /**\n * Renders voxel grid of scene for IBL shadows\n * @param includedMeshes\n * @param registerAfterRenderObservable Whether to register scene onAfterRender callback (legacy path).\n */\n public updateVoxelGrid(includedMeshes: Mesh[], registerAfterRenderObservable: boolean = true) {\n if (this._voxelizationInProgress) {\n return;\n }\n this._stopVoxelization();\n this._voxelizationInProgress = true;\n\n if (this._engine.isWebGPU) {\n // Route through the opacity accumulator only when Gaussian splats are present (they need\n // non-binary accumulation). Regular-mesh-only voxelization writes the grid directly.\n const useBuffer = _HasGaussianSplatting(includedMeshes);\n if (useBuffer) {\n this._ensureVoxelOpacityAccumulator();\n }\n if (useBuffer !== this._useOpacityBuffer) {\n this._useOpacityBuffer = useBuffer;\n this._voxelMaterial.setDefine(\"IBL_VOXEL_OPACITY_BUFFER\", useBuffer);\n }\n }\n\n if (this._engine.isWebGPU) {\n this._voxelGridRT.renderList = includedMeshes;\n this._addRTsForRender([this._voxelGridRT], includedMeshes, 0);\n } else if (this._triPlanarVoxelization) {\n this._addRTsForRender(this._voxelMrtsXaxis, includedMeshes, 0);\n this._addRTsForRender(this._voxelMrtsYaxis, includedMeshes, 1);\n this._addRTsForRender(this._voxelMrtsZaxis, includedMeshes, 2);\n } else {\n this._addRTsForRender(this._voxelMrtsZaxis, includedMeshes, 2);\n }\n if (registerAfterRenderObservable) {\n this._renderVoxelGridBound = this._renderVoxelGrid.bind(this);\n this._scene.onAfterRenderObservable.add(this._renderVoxelGridBound);\n }\n }\n\n /**\n * Advances voxelization work when running in custom render loops (for example FrameGraph tasks)\n * where scene onAfterRender timing may differ from classic pipeline flow.\n */\n public processVoxelization(): void {\n this._renderVoxelGrid();\n }\n\n private _renderVoxelGridBound: () => void;\n\n private _renderVoxelGrid() {\n if (this._voxelizationInProgress) {\n // Wait for shadow-casting GaussianSplatting meshes' depth sort to settle before\n // rasterizing. Voxelization is order-independent — the order splats are drawn never\n // affects the grid — but the GS voxel draw still *indexes* each splat through the\n // `splatIndex` thin-instance buffer, and that buffer is (re)sized, filled and rebound by\n // the sort worker's callback (the same callback that flips `_isDepthSortSettled`). After\n // addPart() merges a splat, `forcedInstanceCount` jumps to the new total synchronously\n // but the index buffer is only finalized when the sort lands; rasterizing in between\n // indexes a stale/mismatched buffer and writes an empty grid (no IBL shadow until a\n // later refresh). Frame-capped so a continuously re-sorting (orbiting) splat still\n // voxelizes eventually rather than blocking forever.\n let gsSortPending = false;\n for (let i = 0; i < this._renderTargets.length && !gsSortPending; i++) {\n const renderList = this._renderTargets[i].renderList;\n if (!renderList) {\n continue;\n }\n for (const mesh of renderList) {\n if (IsGaussianSplattingClassName(mesh.getClassName()) && !(mesh as GaussianSplattingMesh)._isDepthSortSettled) {\n gsSortPending = true;\n break;\n }\n }\n }\n if (gsSortPending && this._sortSettleWaitFrames < _MaxSortSettleWaitFrames) {\n this._sortSettleWaitFrames++;\n return;\n }\n this._sortSettleWaitFrames = 0;\n\n let allReady = this.getVoxelGrid().isReady();\n for (let i = 0; i < this._mipArray.length; i++) {\n const mipReady = this._mipArray[i].isReady();\n allReady &&= mipReady;\n }\n for (let i = 0; i < this._renderTargets.length; i++) {\n const rttReady = this._renderTargets[i].isReadyForRendering();\n allReady &&= rttReady;\n }\n for (const gsVoxelMat of Array.from(this._gsVoxelMaterialCache.values())) {\n allReady &&= gsVoxelMat.isReady();\n }\n if (!allReady) {\n return;\n }\n\n const copyMipEffect = this._copyMipEffectWrapper.effect;\n if (!copyMipEffect.isReady()) {\n return;\n }\n\n if (this._engine.isWebGPU) {\n if (this._useOpacityBuffer) {\n // The copy compute must be ready before we voxelize, else the grid stays unpopulated.\n if (!this._copyBufferToGridCompute || !this._copyBufferToGridCompute.isReady()) {\n return;\n }\n // Reset the accumulator. clear() is a command-encoder op, so it must run before any\n // render pass opens (here, not mid-render).\n this._voxelOpacityBuffer?.clear();\n } else if (this._voxelGrid && this._voxelGrid.renderTarget) {\n // Direct mode (no splats): regular meshes textureStore into the grid, so clear each\n // layer first.\n for (let layer = 0; layer < this._voxelResolution; layer++) {\n this._engine.bindFramebuffer(this._voxelGrid.renderTarget, 0, undefined, undefined, true, 0, layer);\n this._engine.clear(this._voxelClearColor, true, false, false);\n this._engine.unBindFramebuffer(this._voxelGrid.renderTarget, true);\n }\n }\n }\n\n for (const rt of this._renderTargets) {\n rt.render();\n }\n this._stopVoxelization();\n\n if (this._engine.isWebGPU) {\n if (this._useOpacityBuffer) {\n // Decode the atomically-accumulated opacity buffer into the r8 voxel grid (mip 0).\n this._copyVoxelOpacityBufferToGrid();\n }\n } else if (this._triPlanarVoxelization) {\n this._combinedVoxelGridPT.render();\n }\n this._generateMipMaps();\n this._copyMipMaps();\n this._scene.onAfterRenderObservable.removeCallback(this._renderVoxelGridBound);\n this._voxelizationInProgress = false;\n this.onVoxelizationCompleteObservable.notifyObservers();\n }\n }\n\n /**\n * Splits rendering for every voxel RT: non–Gaussian splatting meshes use subMesh.render\n * (material override from setMaterialForRendering); GaussianSplattingMesh uses a custom draw path with its cached voxel ShaderMaterial.\n * @param rtt - the render target texture to install the custom render function on\n */\n private _installVoxelMixedCustomRender(rtt: RenderTargetTexture): void {\n const scene = this._scene;\n const engine = scene.getEngine();\n\n const renderGsSplat = (sm: SubMesh): void => {\n const renderingMesh = sm.getRenderingMesh();\n const effectiveMesh = sm.getEffectiveMesh();\n const gsVoxelMaterial = this._gsVoxelMaterialCache.get(effectiveMesh.uniqueId);\n if (!gsVoxelMaterial || !gsVoxelMaterial.isReady()) {\n return;\n }\n\n const drawWrapper = gsVoxelMaterial._getDrawWrapper();\n if (!drawWrapper?.effect) {\n return;\n }\n const effect = drawWrapper.effect;\n\n const batch = renderingMesh._getInstancesRenderList(sm._id, !!sm.getReplacementMesh());\n if (batch.mustReturn) {\n return;\n }\n\n const hardwareInstancedRendering =\n engine.getCaps().instancedArrays && ((batch.visibleInstances[sm._id] !== null && batch.visibleInstances[sm._id] !== undefined) || renderingMesh.hasThinInstances);\n\n const fillMode = sm.getMaterial()?.fillMode ?? Constants.MATERIAL_TriangleFillMode;\n engine.enableEffect(drawWrapper);\n renderingMesh._bind(sm, effect, fillMode);\n gsVoxelMaterial._preBind(drawWrapper);\n gsVoxelMaterial.bind(effectiveMesh.getWorldMatrix(), effectiveMesh, effect);\n // If rotation/scale textures are missing, bind() logged the warning; skip the draw to avoid GPU errors.\n if (!(effectiveMesh as GaussianSplattingMesh).rotationsATexture) {\n gsVoxelMaterial.unbind();\n return;\n }\n if (engine.isWebGPU) {\n // A GSplat is a 3D Gaussian ellipsoid. To approximate its volume in the voxel grid\n // we rasterize three planar cross-section quads — one per principal axis — each\n // spanning the ellipsoid cross-section perpendicular to that axis. A quad rendered\n // edge-on produces zero fragments, so we draw once per world axis: each draw lets\n // computeVoxelSplatWorldPos pick the quad whose normal best aligns with that view,\n // guaranteeing every splat is captured face-on from at least one direction.\n const viewMatrices = _IblShadowsVoxelRenderer._VOXEL_VIEW_MATRICES;\n for (let axisIdx = 0; axisIdx < 3; axisIdx++) {\n effect.setMatrix(\"viewMatrix\", viewMatrices[axisIdx]);\n renderingMesh._processRendering(effectiveMesh, sm, effect, fillMode, batch, hardwareInstancedRendering, (_isInstance, world) => {\n effect.setMatrix(\"world\", world);\n });\n }\n } else {\n // Accumulate overlapping splats with a MAX blend equation (dst = max(src, dst)) so each\n // cell keeps the strongest occluder; writing 0.0 into non-slab draw buffers is a no-op.\n // Matches the WebGPU atomicMax path; see the opacity-compositing limitation in\n // iblVoxelOpacityAtomicMax.\n const previousAlphaMode = engine.getAlphaMode();\n engine.setAlphaMode(Constants.ALPHA_MAX, true);\n renderingMesh._processRendering(effectiveMesh, sm, effect, fillMode, batch, hardwareInstancedRendering, (_isInstance, world) => effect.setMatrix(\"world\", world));\n engine.setAlphaMode(previousAlphaMode, true);\n }\n gsVoxelMaterial.unbind();\n };\n\n const processBucket = (subMeshes: SmartArray<SubMesh>, enableAlphaMode: boolean): void => {\n for (let i = 0; i < subMeshes.length; i++) {\n const sm = subMeshes.data[i];\n const effective = sm.getEffectiveMesh();\n if (IsGaussianSplattingClassName(effective.getClassName())) {\n renderGsSplat(sm);\n } else {\n sm.render(enableAlphaMode);\n }\n }\n };\n\n rtt.customRenderFunction = (\n opaqueSubMeshes: SmartArray<SubMesh>,\n alphaTestSubMeshes: SmartArray<SubMesh>,\n transparentSubMeshes: SmartArray<SubMesh>,\n depthOnlySubMeshes: SmartArray<SubMesh>\n ): void => {\n if (depthOnlySubMeshes.length) {\n engine.setColorWrite(false);\n processBucket(depthOnlySubMeshes, false);\n engine.setColorWrite(true);\n }\n processBucket(opaqueSubMeshes, false);\n processBucket(alphaTestSubMeshes, false);\n processBucket(transparentSubMeshes, true);\n };\n }\n\n private _addGsMeshToVoxelRT(mrt: RenderTargetTexture, mesh: GaussianSplattingMesh): void {\n let gsVoxelMaterial = this._gsVoxelMaterialCache.get(mesh.uniqueId);\n if (!gsVoxelMaterial) {\n const gsMaterial = mesh.material as GaussianSplattingMaterial;\n if (!gsMaterial) {\n return;\n }\n const shaderLanguage = this._engine.isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL;\n gsVoxelMaterial = gsMaterial.makeVoxelRenderingMaterial(this._scene, shaderLanguage, this._maxDrawBuffers, mesh.isCompound);\n this._gsVoxelMaterialCache.set(mesh.uniqueId, gsVoxelMaterial);\n }\n mrt.renderList?.push(mesh as Mesh);\n mrt.setMaterialForRendering(mesh as Mesh, gsVoxelMaterial);\n }\n\n private _addRTsForRender(mrts: RenderTargetTexture[], includedMeshes: Mesh[], axis: number) {\n const slabSize = 1.0 / this._computeNumberOfSlabs();\n const voxelMaterial = this._voxelMaterial;\n\n // We need to update the world scale uniform for every mesh being rendered to the voxel grid.\n for (let mrtIndex = 0; mrtIndex < mrts.length; mrtIndex++) {\n const mrt = mrts[mrtIndex];\n mrt._disableEngineStages = true;\n mrt.useCameraPostProcesses = false;\n mrt.renderParticles = false;\n mrt.renderSprites = false;\n mrt.enableOutlineRendering = false;\n\n const renderBucket = (bucket: SmartArray<SubMesh>) => {\n for (let index = 0; index < bucket.length; index++) {\n const subMesh = bucket.data[index];\n if (subMesh.getMaterial() !== voxelMaterial) {\n continue;\n }\n subMesh.render(false);\n }\n };\n\n mrt.customRenderFunction = (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) => {\n renderBucket(depthOnlySubMeshes);\n renderBucket(opaqueSubMeshes);\n renderBucket(alphaTestSubMeshes);\n renderBucket(transparentSubMeshes);\n };\n\n mrt.renderList = [];\n const nearPlane = mrtIndex * slabSize;\n const farPlane = (mrtIndex + 1) * slabSize;\n const stepSize = slabSize / this._maxDrawBuffers;\n\n const viewMatrix = _IblShadowsVoxelRenderer._VOXEL_VIEW_MATRICES[axis];\n mrt.onBeforeRenderObservable.clear();\n mrt.onBeforeRenderObservable.add(() => {\n voxelMaterial.setMatrix(\"viewMatrix\", viewMatrix);\n voxelMaterial.setMatrix(\"invWorldScale\", this._invWorldScaleMatrix);\n voxelMaterial.setFloat(\"nearPlane\", nearPlane);\n voxelMaterial.setFloat(\"farPlane\", farPlane);\n voxelMaterial.setFloat(\"stepSize\", stepSize);\n if (this._engine.isWebGPU) {\n this._voxelMaterial.useVertexPulling = true;\n this._voxelMaterial.setTexture(\"voxel_storage\", this.getVoxelGrid());\n if (this._voxelOpacityBuffer) {\n this._voxelMaterial.setStorageBuffer(\"voxelOpacityBuffer\", this._voxelOpacityBuffer);\n }\n }\n // Push per-slab uniforms to each GS voxel material in this MRT's render list.\n for (const m of mrt.renderList ?? []) {\n if (IsGaussianSplattingClassName(m.getClassName())) {\n const gsVoxelMat = this._gsVoxelMaterialCache.get(m.uniqueId);\n if (gsVoxelMat) {\n gsVoxelMat.setMatrix(\"invWorldScale\", this._invWorldScaleMatrix);\n if (this._engine.isWebGPU) {\n // WGSL GS voxel shader uses the same viewMatrix approach as WebGL; the per-axis viewMatrix is set per-draw in renderGsSplat.\n gsVoxelMat.setTexture(\"voxel_storage\", this.getVoxelGrid());\n if (this._voxelOpacityBuffer) {\n gsVoxelMat.setStorageBuffer(\"voxelOpacityBuffer\", this._voxelOpacityBuffer);\n }\n } else {\n gsVoxelMat.setMatrix(\"viewMatrix\", viewMatrix);\n gsVoxelMat.setFloat(\"nearPlane\", nearPlane);\n gsVoxelMat.setFloat(\"farPlane\", farPlane);\n gsVoxelMat.setFloat(\"stepSize\", stepSize);\n }\n }\n }\n }\n });\n\n // Set this material on every mesh in the scene (for this RT)\n if (includedMeshes.length === 0) {\n return;\n }\n for (const mesh of includedMeshes) {\n if (!mesh) {\n continue;\n }\n if (IsGaussianSplattingClassName(mesh.getClassName())) {\n this._addGsMeshToVoxelRT(mrt, mesh as GaussianSplattingMesh);\n } else if (mesh.subMeshes && mesh.subMeshes.length > 0) {\n mrt.renderList?.push(mesh);\n mrt.setMaterialForRendering(mesh, voxelMaterial);\n }\n const meshes = mesh.getChildMeshes();\n for (const childMesh of meshes) {\n if (IsGaussianSplattingClassName(childMesh.getClassName())) {\n this._addGsMeshToVoxelRT(mrt, childMesh as GaussianSplattingMesh);\n } else if (childMesh.subMeshes && childMesh.subMeshes.length > 0) {\n mrt.renderList?.push(childMesh);\n mrt.setMaterialForRendering(childMesh, voxelMaterial);\n }\n }\n }\n\n this._installVoxelMixedCustomRender(mrt);\n }\n\n this._renderTargets = this._renderTargets.concat(mrts);\n }\n\n /**\n * Called by the pipeline to resize resources.\n */\n public resize() {}\n\n /**\n * Disposes the voxel renderer and associated resources\n */\n public dispose() {\n this._disposeVoxelTextures();\n for (const mat of Array.from(this._gsVoxelMaterialCache.values())) {\n mat.dispose();\n }\n this._gsVoxelMaterialCache.clear();\n }\n}\n"]}
|
|
@@ -143,6 +143,13 @@ export declare class _IblShadowsVoxelTracingPass {
|
|
|
143
143
|
set coloredShadows(value: boolean);
|
|
144
144
|
get coloredShadows(): boolean;
|
|
145
145
|
private _coloredShadows;
|
|
146
|
+
/**
|
|
147
|
+
* Maximum number of translucent voxels a shadow ray roulettes through before it is treated as
|
|
148
|
+
* unoccluded. Higher values converge more accurately at extra cost. Applied via a shader define.
|
|
149
|
+
*/
|
|
150
|
+
set maxVoxelRouletteTests(value: number);
|
|
151
|
+
get maxVoxelRouletteTests(): number;
|
|
152
|
+
private _maxVoxelRouletteTests;
|
|
146
153
|
private _debugVoxelMarchEnabled;
|
|
147
154
|
private _debugPassPP;
|
|
148
155
|
private _debugSizeParams;
|