@babylonjs/core 9.9.1 → 9.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +34 -1
- package/AudioV2/abstractAudio/audioEngineV2.js +54 -0
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +12 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +18 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
- package/AudioV2/abstractAudio/index.d.ts +1 -0
- package/AudioV2/abstractAudio/index.js +1 -0
- package/AudioV2/abstractAudio/index.js.map +1 -1
- package/AudioV2/abstractAudio/pure.d.ts +1 -0
- package/AudioV2/abstractAudio/pure.js +1 -0
- package/AudioV2/abstractAudio/pure.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +7 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +12 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +14 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +4 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +12 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +2 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +4 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +2 -1
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +16 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +2 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +5 -2
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
- package/Gizmos/index.d.ts +1 -0
- package/Gizmos/index.js +1 -0
- package/Gizmos/index.js.map +1 -1
- package/Gizmos/pure.d.ts +1 -0
- package/Gizmos/pure.js +1 -0
- package/Gizmos/pure.js.map +1 -1
- package/Gizmos/spatialAudioGizmo.d.ts +55 -0
- package/Gizmos/spatialAudioGizmo.js +151 -0
- package/Gizmos/spatialAudioGizmo.js.map +1 -0
- package/Layers/selectionOutlineLayer.pure.d.ts +9 -2
- package/Layers/selectionOutlineLayer.pure.js +29 -6
- package/Layers/selectionOutlineLayer.pure.js.map +1 -1
- package/Layers/thinEffectLayer.d.ts +1 -0
- package/Layers/thinEffectLayer.js +7 -4
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +17 -3
- package/Layers/thinSelectionOutlineLayer.js +82 -17
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +5 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +54 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.d.ts +13 -0
- package/Materials/PBR/openpbrMaterial.pure.js +17 -0
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js +3 -2
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +32 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +180 -22
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +54 -10
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +130 -13
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.d.ts +5 -1
- package/Meshes/abstractMesh.pure.js +92 -2
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.pure.js +143 -2
- package/Meshes/thinInstanceMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.types.d.ts +2 -1
- package/Meshes/thinInstanceMesh.types.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +12 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.js +8 -0
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.js +4 -2
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +54 -5
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +14 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingVoxel.vertex.js +1 -0
- package/Shaders/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/Shaders/selectionOutline.fragment.js +16 -4
- package/Shaders/selectionOutline.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +56 -5
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +2 -3
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +14 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +1 -0
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/ShadersWGSL/selectionOutline.fragment.js +14 -2
- package/ShadersWGSL/selectionOutline.fragment.js.map +1 -1
- package/XR/features/WebXRBodyTracking.pure.d.ts +16 -0
- package/XR/features/WebXRBodyTracking.pure.js +167 -30
- package/XR/features/WebXRBodyTracking.pure.js.map +1 -1
- package/package.json +1 -1
|
@@ -486,7 +486,8 @@ export class ObjectRenderer {
|
|
|
486
486
|
if (!this.dontSetTransformationMatrix) {
|
|
487
487
|
this._scene.setTransformMatrix(camera.getViewMatrix(), camera.getProjectionMatrix(true));
|
|
488
488
|
}
|
|
489
|
-
|
|
489
|
+
// Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged for this internal render pass.
|
|
490
|
+
this._scene._activeCamera = camera;
|
|
490
491
|
this._engine.setViewport(camera.rigParent ? camera.rigParent.viewport : camera.viewport, viewportWidth, viewportHeight);
|
|
491
492
|
}
|
|
492
493
|
if (this._useUBO) {
|
|
@@ -505,7 +506,8 @@ export class ObjectRenderer {
|
|
|
505
506
|
if (this._disableImageProcessing) {
|
|
506
507
|
scene.imageProcessingConfiguration._applyByPostProcess = this._currentApplyByPostProcessSetting;
|
|
507
508
|
}
|
|
508
|
-
|
|
509
|
+
// Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged for this internal render pass.
|
|
510
|
+
scene._activeCamera = this._currentSceneCamera;
|
|
509
511
|
if (this._currentSceneCamera) {
|
|
510
512
|
if (this.activeCamera && this.activeCamera !== scene.activeCamera) {
|
|
511
513
|
scene.setTransformMatrix(this._currentSceneCamera.getViewMatrix(), this._currentSceneCamera.getProjectionMatrix(true));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectRenderer.js","sourceRoot":"","sources":["../../../../dev/core/src/Rendering/objectRenderer.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAiB1D;;;GAGG;AACH,MAAM,OAAO,cAAc;IAwBvB;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAoC;QACtD,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;YAC7B,OAAO;QACX,CAAC;QACD,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC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AAC;QACzC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,wCAAwC,CAAC,KAAK,EAAE,CAAC;QACtD,IAAI,CAAC,uCAAuC,CAAC,KAAK,EAAE,CAAC;QACrD,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;QAExC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChC,GAAG,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;QACL,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,SAAgB,CAAC;QAEnC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,gBAAgB;IACT,QAAQ;QACX,IAAI,IAAI,CAAC,WAAW,KAAK,cAAc,CAAC,uBAAuB,EAAE,CAAC;YAC9D,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,uBAAuB,CAAC;QAC9D,CAAC;IACL,CAAC;IAED;;OAEG;IACI,mBAAmB;QACtB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QACjD,CAAC;IACL,CAAC;;AAvjCD;;GAEG;AACoB,sCAAuB,GAAW,CAAC,AAAZ,CAAa;AAC3D;;GAEG;AACoB,8CAA+B,GAAW,CAAC,AAAZ,CAAa;AACnE;;;GAGG;AACoB,kDAAmC,GAAW,CAAC,AAAZ,CAAa","sourcesContent":["import {\r\n type Nullable,\r\n type Immutable,\r\n type Camera,\r\n type Scene,\r\n type AbstractMesh,\r\n type SubMesh,\r\n type Material,\r\n type IParticleSystem,\r\n type InstancedMesh,\r\n type BoundingBox,\r\n type BoundingBoxRenderer,\r\n type AbstractEngine,\r\n type ClusteredLightContainer,\r\n} from \"core/index\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { RenderingManager } from \"../Rendering/renderingManager\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { _ObserveArray } from \"../Misc/arrayTools\";\r\nimport { _RetryWithInterval } from \"../Misc/timingTools\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { LightConstants } from \"../Lights/lightConstants\";\r\n\r\n/**\r\n * Defines the options of the object renderer\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface ObjectRendererOptions {\r\n /** The number of passes the renderer will support (1 by default) */\r\n numPasses?: number;\r\n\r\n /** True (default) to not change the aspect ratio of the scene in the RTT */\r\n doNotChangeAspectRatio?: boolean;\r\n\r\n /** True to enable clustered lights (default: false) */\r\n enableClusteredLights?: boolean;\r\n}\r\n\r\n/**\r\n * A class that renders objects to the currently bound render target.\r\n * This class only renders objects, and is not concerned with the output texture or post-processing.\r\n */\r\nexport class ObjectRenderer {\r\n /**\r\n * Objects will only be rendered once which can be useful to improve performance if everything in your render is static for instance.\r\n */\r\n public static readonly REFRESHRATE_RENDER_ONCE: number = 0;\r\n /**\r\n * Objects will be rendered every frame and is recommended for dynamic contents.\r\n */\r\n public static readonly REFRESHRATE_RENDER_ONEVERYFRAME: number = 1;\r\n /**\r\n * Objects will be rendered every 2 frames which could be enough if your dynamic objects are not\r\n * the central point of your effect and can save a lot of performances.\r\n */\r\n public static readonly REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number = 2;\r\n\r\n /**\r\n * Use this predicate to dynamically define the list of mesh you want to render.\r\n * If set, the renderList property will be overwritten.\r\n */\r\n public renderListPredicate: (AbstractMesh: AbstractMesh) => boolean;\r\n\r\n private _renderList: Nullable<Array<AbstractMesh>>;\r\n private _unObserveRenderList: Nullable<() => void> = null;\r\n\r\n /**\r\n * Use this list to define the list of mesh you want to render.\r\n */\r\n public get renderList(): Nullable<Array<AbstractMesh>> {\r\n return this._renderList;\r\n }\r\n\r\n public set renderList(value: Nullable<Array<AbstractMesh>>) {\r\n if (this._renderList === value) {\r\n return;\r\n }\r\n if (this._unObserveRenderList) {\r\n this._unObserveRenderList();\r\n this._unObserveRenderList = null;\r\n }\r\n\r\n if (value) {\r\n this._unObserveRenderList = _ObserveArray(value, this._renderListHasChanged);\r\n }\r\n\r\n this._renderList = value;\r\n }\r\n\r\n private _renderListHasChanged = (_functionName: string, previousLength: number) => {\r\n const newLength = this._renderList ? this._renderList.length : 0;\r\n if ((previousLength === 0 && newLength > 0) || newLength === 0) {\r\n for (const mesh of this._scene.meshes) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * Define the list of particle systems to render. If not provided, will render all the particle systems of the scene.\r\n * Note that the particle systems are rendered only if renderParticles is set to true.\r\n */\r\n public particleSystemList: Nullable<Array<IParticleSystem>> = null;\r\n\r\n /**\r\n * Use this function to overload the renderList array at rendering time.\r\n * Return null to render with the current renderList, else return the list of meshes to use for rendering.\r\n * For 2DArray, layerOrFace is the index of the layer that is going to be rendered, else it is the faceIndex of\r\n * the cube (if the RTT is a cube, else layerOrFace=0).\r\n * The renderList passed to the function is the current render list (the one that will be used if the function returns null).\r\n * The length of this list is passed through renderListLength: don't use renderList.length directly because the array can\r\n * hold dummy elements!\r\n */\r\n public getCustomRenderList: Nullable<(layerOrFace: number, renderList: Nullable<Immutable<Array<AbstractMesh>>>, renderListLength: number) => Nullable<Array<AbstractMesh>>> =\r\n null;\r\n\r\n /**\r\n * Define if meshes should be rendered (default is true).\r\n */\r\n public renderMeshes = true;\r\n\r\n /**\r\n * Define if depth only meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderDepthOnlyMeshes = true;\r\n\r\n /**\r\n * Define if opaque meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderOpaqueMeshes = true;\r\n\r\n /**\r\n * Define if alpha test meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderAlphaTestMeshes = true;\r\n\r\n /**\r\n * Define if transparent meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderTransparentMeshes = true;\r\n\r\n /**\r\n * Custom render function for transparent submeshes.\r\n */\r\n public customRenderTransparentSubMeshes?: (transparentSubMeshes: SmartArray<SubMesh>) => void;\r\n\r\n /**\r\n * Define if particles should be rendered (default is true).\r\n */\r\n public renderParticles = true;\r\n\r\n /**\r\n * Define if sprites should be rendered (default is false).\r\n */\r\n public renderSprites = false;\r\n\r\n /**\r\n * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined)\r\n */\r\n public forceLayerMaskCheck = false;\r\n\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is false.\r\n */\r\n public enableBoundingBoxRendering = false;\r\n\r\n /**\r\n * Enables the rendering of outline/overlay for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public enableOutlineRendering = true;\r\n\r\n /**\r\n * Define the camera used to render the objects.\r\n */\r\n public activeCamera: Nullable<Camera>;\r\n\r\n /**\r\n * Define the camera used to calculate the LOD of the objects.\r\n * If not defined, activeCamera will be used. If not defined nor activeCamera, scene's active camera will be used.\r\n */\r\n public cameraForLOD: Nullable<Camera>;\r\n\r\n private _disableImageProcessing = false;\r\n /**\r\n * If true, the object renderer will render all objects without any image processing applied.\r\n * If false (default value), the renderer will use the current setting of the scene's image processing configuration.\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_ImageProcessingDirtyFlag);\r\n }\r\n\r\n /**\r\n * If true, the object renderer will not set the view/projection/transformation matrices for the active camera (default: false).\r\n * By default, the view/projection/transformation matrices are set from the active camera (either ObjectRenderer.activeCamera or scene.activeCamera).\r\n * Sets this property to true if you want to define your own transformation matrices (use the onInitRenderingObservable observable\r\n * to set your own matrices, to be sure they will be correctly taken into account)\r\n */\r\n public dontSetTransformationMatrix = false;\r\n\r\n private _disableDepthPrePass = false;\r\n /**\r\n * Specifies to disable depth pre-pass if true (default: false)\r\n */\r\n public get disableDepthPrePass() {\r\n return this._disableDepthPrePass;\r\n }\r\n\r\n public set disableDepthPrePass(value: boolean) {\r\n this._disableDepthPrePass = value;\r\n this._renderingManager.disableDepthPrePass = value;\r\n }\r\n\r\n /**\r\n * Override the mesh isReady function with your own one.\r\n */\r\n public customIsReadyFunction: (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => boolean;\r\n\r\n /**\r\n * Override the render function with your own one.\r\n */\r\n public customRenderFunction: (\r\n opaqueSubMeshes: SmartArray<SubMesh>,\r\n alphaTestSubMeshes: SmartArray<SubMesh>,\r\n transparentSubMeshes: SmartArray<SubMesh>,\r\n depthOnlySubMeshes: SmartArray<SubMesh>,\r\n beforeTransparents?: () => void\r\n ) => void;\r\n\r\n /**\r\n * An event triggered before rendering the objects.\r\n * Note: This observable is also triggered during readiness checks (e.g. when calling scene.isReady()),\r\n * in which case the render target is not bound to the output. Observers should avoid performing\r\n * GPU state changes (such as clearing or modifying the framebuffer) unless the render target is actually bound.\r\n */\r\n public readonly onBeforeRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered after rendering the objects.\r\n * Note: This observable is also triggered during readiness checks (e.g. when calling scene.isReady()),\r\n * in which case the render target is not bound to the output. Observers should avoid performing\r\n * GPU state changes (such as clearing or modifying the framebuffer) unless the render target is actually bound.\r\n */\r\n public readonly onAfterRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered before the rendering group is processed\r\n */\r\n public readonly onBeforeRenderingManagerRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered after the rendering group is processed\r\n */\r\n public readonly onAfterRenderingManagerRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered when initRender is called\r\n */\r\n public readonly onInitRenderingObservable = new Observable<ObjectRenderer>();\r\n\r\n /**\r\n * An event triggered when finishRender is called\r\n */\r\n public readonly onFinishRenderingObservable = new Observable<ObjectRenderer>();\r\n\r\n /**\r\n * An event triggered when fast path rendering is used\r\n */\r\n public readonly onFastPathRenderObservable = new Observable<number>();\r\n\r\n protected _engine: AbstractEngine;\r\n protected _scene: Scene;\r\n protected _renderingManager: RenderingManager;\r\n /** @internal */\r\n public _waitingRenderList?: string[];\r\n protected _currentRefreshId = -1;\r\n protected _refreshRate = 1;\r\n protected _currentApplyByPostProcessSetting = false;\r\n protected _activeMeshes = new SmartArray<AbstractMesh>(256);\r\n protected _activeBoundingBoxes = new SmartArray<BoundingBox>(32);\r\n protected _useUBO: boolean;\r\n protected _sceneUBOs: UniformBuffer[]; // It's an array because we may need multiple ubos per frame if the object renderer is used several times in a frame (e.g. for rigged cameras)\r\n protected _sceneUBOIsMultiview: boolean[]; // Parallel array caching the multiview state per UBO slot — avoids getUniformNames().indexOf() in the hot path\r\n protected _currentSceneUBO: UniformBuffer;\r\n protected _currentFrameId = -1;\r\n protected _currentSceneUBOIndex = 0;\r\n\r\n /**\r\n * The options used by the object renderer\r\n */\r\n public options: Required<ObjectRendererOptions>;\r\n\r\n private _name: string;\r\n /**\r\n * Friendly name of the object renderer\r\n */\r\n public get name() {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n if (this._name === value) {\r\n return;\r\n }\r\n\r\n this._name = value;\r\n if (this._sceneUBOs) {\r\n for (let i = 0; i < this._sceneUBOs.length; ++i) {\r\n this._sceneUBOs[i].name = `Scene ubo #${i} for ${this.name}`;\r\n }\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < this._renderPassIds.length; ++i) {\r\n const renderPassId = this._renderPassIds[i];\r\n this._engine._renderPassNames[renderPassId] = `${this._name}#${i}`;\r\n }\r\n }\r\n\r\n /**\r\n * Current render pass id. Note it can change over the rendering as there's a separate id for each face of a cube / each layer of an array layer!\r\n */\r\n public renderPassId: number;\r\n private readonly _renderPassIds: number[];\r\n /**\r\n * Gets the render pass ids used by the object renderer.\r\n */\r\n public get renderPassIds(): readonly number[] {\r\n return this._renderPassIds;\r\n }\r\n\r\n /**\r\n * Gets the current value of the refreshId counter\r\n */\r\n public get currentRefreshId() {\r\n return this._currentRefreshId;\r\n }\r\n\r\n /**\r\n * Gets the array of active meshes\r\n * @returns an array of AbstractMesh\r\n */\r\n public getActiveMeshes(): SmartArray<AbstractMesh> {\r\n return this._activeMeshes;\r\n }\r\n\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes with this object renderer\r\n * @param mesh mesh or array of meshes\r\n * @param material material or array of materials to use for this render pass. If undefined is passed, no specific material will be used but the regular material instead (mesh.material). It's possible to provide an array of materials to use a different material for each rendering pass.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material | Material[]): void {\r\n let meshes;\r\n if (!Array.isArray(mesh)) {\r\n meshes = [mesh];\r\n } else {\r\n meshes = mesh;\r\n }\r\n for (let j = 0; j < meshes.length; ++j) {\r\n for (let i = 0; i < this.options.numPasses; ++i) {\r\n let mesh = meshes[j];\r\n if (meshes[j].isAnInstance) {\r\n mesh = (meshes[j] as InstancedMesh).sourceMesh;\r\n }\r\n mesh.setMaterialForRenderPass(this._renderPassIds[i], material !== undefined ? (Array.isArray(material) ? material[i] : material) : undefined);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _isFrozen = false;\r\n\r\n /** @internal */\r\n public _freezeActiveMeshesCancel: Nullable<() => void> = null;\r\n\r\n /** @internal */\r\n public _freezeActiveMeshes(freezeMeshes: boolean) {\r\n this._freezeActiveMeshesCancel = _RetryWithInterval(\r\n () => {\r\n return this._checkReadiness();\r\n },\r\n () => {\r\n this._freezeActiveMeshesCancel = null;\r\n if (freezeMeshes) {\r\n for (let index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._freeze();\r\n }\r\n }\r\n this._prepareRenderingManager(0, true);\r\n this._isFrozen = true;\r\n },\r\n (err, isTimeout) => {\r\n this._freezeActiveMeshesCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"ObjectRenderer: An unexpected error occurred while waiting for the renderer to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(`ObjectRenderer: Timeout while waiting for the renderer to be ready.`);\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n }\r\n );\r\n }\r\n\r\n /** @internal */\r\n public _unfreezeActiveMeshes() {\r\n this._freezeActiveMeshesCancel?.();\r\n this._freezeActiveMeshesCancel = null;\r\n for (let index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._unFreeze();\r\n }\r\n this._isFrozen = false;\r\n }\r\n\r\n /**\r\n * Instantiates an object renderer.\r\n * @param name The friendly name of the object renderer\r\n * @param scene The scene the renderer belongs to\r\n * @param options The options used to create the renderer (optional)\r\n */\r\n constructor(name: string, scene: Scene, options?: ObjectRendererOptions) {\r\n this.name = name;\r\n this._scene = scene;\r\n this._engine = this._scene.getEngine();\r\n this._useUBO = this._engine.supportsUniformBuffers;\r\n\r\n this.renderList = [] as AbstractMesh[];\r\n this._renderPassIds = [];\r\n\r\n this.options = {\r\n numPasses: 1,\r\n doNotChangeAspectRatio: true,\r\n enableClusteredLights: false,\r\n ...options,\r\n };\r\n\r\n this._createRenderPassId();\r\n\r\n this.renderPassId = this._renderPassIds[0];\r\n\r\n // Rendering groups\r\n this._renderingManager = new RenderingManager(scene);\r\n this._renderingManager._useSceneAutoClearSetup = true;\r\n\r\n if (this.options.enableClusteredLights) {\r\n this.onInitRenderingObservable.add(() => {\r\n for (const light of this._scene.lights) {\r\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_CLUSTERED_CONTAINER && (light as ClusteredLightContainer).isSupported) {\r\n (light as ClusteredLightContainer)._updateBatches(this.activeCamera).render();\r\n }\r\n }\r\n });\r\n }\r\n\r\n this._scene.addObjectRenderer(this);\r\n }\r\n\r\n private _releaseRenderPassId(): void {\r\n for (let i = 0; i < this.options.numPasses; ++i) {\r\n this._engine.releaseRenderPassId(this._renderPassIds[i]);\r\n }\r\n this._renderPassIds.length = 0;\r\n }\r\n\r\n private _createRenderPassId(): void {\r\n this._releaseRenderPassId();\r\n\r\n for (let i = 0; i < this.options.numPasses; ++i) {\r\n this._renderPassIds[i] = this._engine.createRenderPassId(`${this.name}#${i}`);\r\n }\r\n }\r\n\r\n private _createSceneUBO(name: string, isMultiview: boolean): UniformBuffer {\r\n const engine = this._scene.getEngine();\r\n const ubo = new UniformBuffer(engine, undefined, isMultiview, name, undefined, false);\r\n ubo.addUniform(\"viewProjection\", 16);\r\n if (isMultiview) {\r\n ubo.addUniform(\"viewProjectionR\", 16);\r\n }\r\n ubo.addUniform(\"view\", 16);\r\n ubo.addUniform(\"projection\", 16);\r\n ubo.addUniform(\"vEyePosition\", 4);\r\n ubo.addUniform(\"inverseProjection\", 16);\r\n return ubo;\r\n }\r\n\r\n private _getSceneUBO(): UniformBuffer {\r\n if (this._currentFrameId !== this._engine.frameId) {\r\n this._currentSceneUBOIndex = 0;\r\n this._currentFrameId = this._engine.frameId;\r\n }\r\n\r\n if (!this._sceneUBOs) {\r\n this._sceneUBOs = [];\r\n this._sceneUBOIsMultiview = [];\r\n }\r\n\r\n const activeRenderTarget = this._engine._currentRenderTarget;\r\n const isMultiview = !!(activeRenderTarget && activeRenderTarget.texture?.isMultiview) || !!(this._scene as any)._multiviewSceneUboIsActive;\r\n\r\n // Check if we have enough UBOs or if the current one is compatible\r\n if (this._currentSceneUBOIndex >= this._sceneUBOs.length) {\r\n const index = this._sceneUBOs.length;\r\n this._sceneUBOs.push(this._createSceneUBO(`Scene ubo #${index} for ${this.name}`, isMultiview));\r\n this._sceneUBOIsMultiview.push(isMultiview);\r\n } else if (this._sceneUBOIsMultiview[this._currentSceneUBOIndex] !== isMultiview) {\r\n // Layout mismatch, recreate\r\n this._sceneUBOs[this._currentSceneUBOIndex].dispose();\r\n this._sceneUBOs[this._currentSceneUBOIndex] = this._createSceneUBO(`Scene ubo #${this._currentSceneUBOIndex} for ${this.name}`, isMultiview);\r\n this._sceneUBOIsMultiview[this._currentSceneUBOIndex] = isMultiview;\r\n }\r\n\r\n const ubo = this._sceneUBOs[this._currentSceneUBOIndex++];\r\n ubo.unbindEffect();\r\n\r\n return ubo;\r\n }\r\n\r\n /**\r\n * Resets the refresh counter of the renderer and start back from scratch.\r\n * Could be useful to re-render if it is setup to render only once.\r\n */\r\n public resetRefreshCounter(): void {\r\n this._currentRefreshId = -1;\r\n }\r\n\r\n /**\r\n * Defines the refresh rate of the rendering or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n public get refreshRate(): number {\r\n return this._refreshRate;\r\n }\r\n public set refreshRate(value: number) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n }\r\n\r\n /**\r\n * Indicates if the renderer should render the current frame.\r\n * The output is based on the specified refresh rate.\r\n * When snapshot rendering is active, this always returns true to ensure render pass\r\n * topology stays consistent between the recording frame and playback frames.\r\n * @returns true if the renderer should render the current frame\r\n */\r\n public shouldRender(): boolean {\r\n if (this._engine.snapshotRendering) {\r\n // When snapshot rendering is active (recording or playing), we must always render\r\n // to ensure the number of render passes stays consistent between the recording frame\r\n // and all playback frames. If a render target is skipped during recording but not\r\n // during playback (or vice versa), the recorded bundle list indices become misaligned,\r\n // causing visual artifacts such as flickering.\r\n return true;\r\n }\r\n\r\n if (this._currentRefreshId === -1) {\r\n // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n\r\n this._currentRefreshId++;\r\n return false;\r\n }\r\n\r\n /**\r\n * This function will check if the renderer is ready to render (textures are loaded, shaders are compiled)\r\n * @param viewportWidth defines the width of the viewport\r\n * @param viewportHeight defines the height of the viewport\r\n * @returns true if all required resources are ready\r\n */\r\n public isReadyForRendering(viewportWidth: number, viewportHeight: number): boolean {\r\n this.prepareRenderList();\r\n this.initRender(viewportWidth, viewportHeight);\r\n\r\n const isReady = this._checkReadiness();\r\n\r\n this.finishRender();\r\n\r\n return isReady;\r\n }\r\n\r\n /**\r\n * Makes sure the list of meshes is ready to be rendered\r\n * You should call this function before \"initRender\", but if you know the render list is ok, you may call \"initRender\" directly\r\n */\r\n public prepareRenderList(): void {\r\n const scene = this._scene;\r\n\r\n if (this._waitingRenderList) {\r\n if (!this.renderListPredicate) {\r\n this.renderList = [];\r\n for (let index = 0; index < this._waitingRenderList.length; index++) {\r\n const id = this._waitingRenderList[index];\r\n const mesh = scene.getMeshById(id);\r\n if (mesh) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n this._waitingRenderList = undefined;\r\n }\r\n\r\n // Is predicate defined?\r\n if (this.renderListPredicate) {\r\n if (this.renderList) {\r\n this.renderList.length = 0; // Clear previous renderList\r\n } else {\r\n this.renderList = [];\r\n }\r\n\r\n const sceneMeshes = this._scene.meshes;\r\n\r\n for (let index = 0; index < sceneMeshes.length; index++) {\r\n const mesh = sceneMeshes[index];\r\n if (this.renderListPredicate(mesh)) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n\r\n this._currentApplyByPostProcessSetting = this._scene.imageProcessingConfiguration.applyByPostProcess;\r\n if (this._disableImageProcessing) {\r\n // we do not use the applyByPostProcess setter to avoid flagging all the materials as \"image processing dirty\"!\r\n this._scene.imageProcessingConfiguration._applyByPostProcess = this._disableImageProcessing;\r\n }\r\n }\r\n\r\n private _defaultRenderListPrepared: boolean;\r\n private _currentSceneCamera: Nullable<Camera> = null;\r\n\r\n /**\r\n * This method makes sure everything is setup before \"render\" can be called\r\n * @param viewportWidth Width of the viewport to render to\r\n * @param viewportHeight Height of the viewport to render to\r\n */\r\n public initRender(viewportWidth: number, viewportHeight: number): void {\r\n const camera: Nullable<Camera> = this.activeCamera ?? this._scene.activeCamera;\r\n\r\n this._currentSceneCamera = this._scene.activeCamera;\r\n\r\n if (this._useUBO) {\r\n this._currentSceneUBO = this._scene.getSceneUniformBuffer();\r\n this._currentSceneUBO.unbindEffect();\r\n this._scene.setSceneUniformBuffer(this._getSceneUBO());\r\n }\r\n\r\n this.onInitRenderingObservable.notifyObservers(this);\r\n\r\n if (camera) {\r\n if (!this.dontSetTransformationMatrix) {\r\n this._scene.setTransformMatrix(camera.getViewMatrix(), camera.getProjectionMatrix(true));\r\n }\r\n this._scene.activeCamera = camera;\r\n this._engine.setViewport(camera.rigParent ? camera.rigParent.viewport : camera.viewport, viewportWidth, viewportHeight);\r\n }\r\n\r\n if (this._useUBO) {\r\n this._scene.finalizeSceneUbo();\r\n }\r\n\r\n this._defaultRenderListPrepared = false;\r\n }\r\n\r\n /**\r\n * This method must be called after the \"render\" call(s), to complete the rendering process.\r\n */\r\n public finishRender() {\r\n const scene = this._scene;\r\n\r\n if (this._useUBO) {\r\n this._scene.setSceneUniformBuffer(this._currentSceneUBO);\r\n }\r\n\r\n if (this._disableImageProcessing) {\r\n scene.imageProcessingConfiguration._applyByPostProcess = this._currentApplyByPostProcessSetting;\r\n }\r\n\r\n scene.activeCamera = this._currentSceneCamera;\r\n if (this._currentSceneCamera) {\r\n if (this.activeCamera && this.activeCamera !== scene.activeCamera) {\r\n scene.setTransformMatrix(this._currentSceneCamera.getViewMatrix(), this._currentSceneCamera.getProjectionMatrix(true));\r\n }\r\n this._engine.setViewport(this._currentSceneCamera.viewport);\r\n }\r\n\r\n scene.resetCachedMaterial();\r\n\r\n this.onFinishRenderingObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Renders all the objects (meshes, particles systems, sprites) to the currently bound render target texture.\r\n * @param passIndex defines the pass index to use (default: 0)\r\n * @param skipOnAfterRenderObservable defines a flag to skip raising the onAfterRenderObservable\r\n */\r\n public render(passIndex = 0, skipOnAfterRenderObservable = false): void {\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n\r\n this._engine.currentRenderPassId = this._renderPassIds[passIndex];\r\n\r\n this.onBeforeRenderObservable.notifyObservers(passIndex);\r\n\r\n const fastPath = this._engine.snapshotRendering && this._engine.snapshotRenderingMode === Constants.SNAPSHOTRENDERING_FAST;\r\n\r\n if (!fastPath) {\r\n const currentRenderList = this._prepareRenderingManager(passIndex);\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import outlineRenderer\r\n const outlineRenderer = (this._scene as any).getOutlineRenderer?.();\r\n const outlineRendererIsEnabled = outlineRenderer?.enabled;\r\n\r\n if (outlineRenderer) {\r\n outlineRenderer.enabled = this.enableOutlineRendering;\r\n }\r\n\r\n this.onBeforeRenderingManagerRenderObservable.notifyObservers(passIndex);\r\n\r\n this._renderingManager.render(\r\n this.customRenderFunction,\r\n currentRenderList,\r\n this.renderParticles,\r\n this.renderSprites,\r\n this.renderDepthOnlyMeshes,\r\n this.renderOpaqueMeshes,\r\n this.renderAlphaTestMeshes,\r\n this.renderTransparentMeshes,\r\n this.customRenderTransparentSubMeshes\r\n );\r\n this.onAfterRenderingManagerRenderObservable.notifyObservers(passIndex);\r\n\r\n if (outlineRenderer) {\r\n outlineRenderer.enabled = outlineRendererIsEnabled;\r\n }\r\n } else {\r\n this.onFastPathRenderObservable.notifyObservers(passIndex);\r\n }\r\n\r\n if (!skipOnAfterRenderObservable) {\r\n this.onAfterRenderObservable.notifyObservers(passIndex);\r\n }\r\n\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n }\r\n\r\n /** @internal */\r\n public _checkReadiness(): boolean {\r\n const scene = this._scene;\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n\r\n let returnValue = true;\r\n\r\n if (!scene.getViewMatrix()) {\r\n // We probably didn't execute scene.render() yet, so make sure we have a view/projection matrix setup for the scene\r\n scene.updateTransformMatrix();\r\n }\r\n\r\n const numPasses = this.options.numPasses;\r\n for (let passIndex = 0; passIndex < numPasses && returnValue; passIndex++) {\r\n const defaultRenderList = this.renderList ? this.renderList : scene.frameGraph ? scene.meshes : scene.getActiveMeshes().data;\r\n const defaultRenderListLength = this.renderList || scene.frameGraph ? defaultRenderList.length : scene.getActiveMeshes().length;\r\n\r\n this._engine.currentRenderPassId = this._renderPassIds[passIndex];\r\n\r\n this.onBeforeRenderObservable.notifyObservers(passIndex);\r\n\r\n let currentRenderList: Nullable<Array<AbstractMesh>> = null;\r\n let currentRenderListLength = defaultRenderListLength;\r\n\r\n if (this.getCustomRenderList) {\r\n currentRenderList = this.getCustomRenderList(passIndex, defaultRenderList, defaultRenderListLength);\r\n if (currentRenderList) {\r\n currentRenderListLength = currentRenderList.length;\r\n }\r\n }\r\n\r\n if (!currentRenderList) {\r\n currentRenderList = defaultRenderList;\r\n }\r\n\r\n if (!this.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n\r\n for (let i = 0; i < currentRenderListLength && returnValue; ++i) {\r\n const mesh = currentRenderList[i];\r\n\r\n if (!mesh.isEnabled() || mesh.isBlocked || !mesh.isVisible || !mesh.subMeshes) {\r\n continue;\r\n }\r\n\r\n if (this.customIsReadyFunction) {\r\n if (!this.customIsReadyFunction(mesh, this.refreshRate, true)) {\r\n returnValue = false;\r\n continue;\r\n }\r\n } else if (!mesh.isReady(true)) {\r\n returnValue = false;\r\n continue;\r\n }\r\n }\r\n\r\n this.onAfterRenderObservable.notifyObservers(passIndex);\r\n\r\n if (numPasses > 1) {\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n\r\n const particleSystems = this.particleSystemList || scene.particleSystems;\r\n for (const particleSystem of particleSystems) {\r\n if (!particleSystem.isReady()) {\r\n returnValue = false;\r\n }\r\n }\r\n\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n\r\n return returnValue;\r\n }\r\n\r\n private _prepareRenderingManager(passIndex = 0, winterIsComing = false): Array<AbstractMesh> {\r\n const scene = this._scene;\r\n\r\n // Get the list of meshes to dispatch to the rendering manager\r\n let currentRenderList: Nullable<Array<AbstractMesh>> = null;\r\n let currentRenderListLength: number;\r\n let checkLayerMask: boolean;\r\n\r\n const defaultRenderList = this.renderList ? this.renderList : scene.frameGraph ? scene.meshes : scene.getActiveMeshes().data;\r\n const defaultRenderListLength = this.renderList || scene.frameGraph ? defaultRenderList.length : scene.getActiveMeshes().length;\r\n\r\n if (this.getCustomRenderList) {\r\n currentRenderList = this.getCustomRenderList(passIndex, defaultRenderList, defaultRenderListLength);\r\n }\r\n\r\n if (!currentRenderList) {\r\n // No custom render list provided, we prepare the rendering for the default list, but check\r\n // first if we did not already performed the preparation (in this frame) before so as to avoid re-doing it several times.\r\n // In WebGPU, instance data (visibleInstances) is stored per render pass ID. Each cascade/face (in CSM) uses a different\r\n // render pass ID, so we must re-prepare for each pass to register instances in the correct per-pass storage.\r\n if (this._defaultRenderListPrepared && !winterIsComing && !this._engine.isWebGPU) {\r\n return defaultRenderList;\r\n }\r\n this._defaultRenderListPrepared = true;\r\n currentRenderList = defaultRenderList;\r\n currentRenderListLength = defaultRenderListLength;\r\n checkLayerMask = !this.renderList || this.forceLayerMaskCheck;\r\n } else {\r\n // Prepare the rendering for the custom render list provided\r\n currentRenderListLength = currentRenderList.length;\r\n checkLayerMask = this.forceLayerMaskCheck;\r\n }\r\n\r\n const camera = scene.activeCamera; // note that at this point, scene.activeCamera == this.activeCamera if defined, because initRender() has been called before\r\n const cameraForLOD = this.cameraForLOD ?? camera;\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (scene as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n if (scene._activeMeshesFrozen && this._isFrozen) {\r\n this._renderingManager.resetSprites();\r\n\r\n if (this.enableBoundingBoxRendering && boundingBoxRenderer) {\r\n boundingBoxRenderer.reset();\r\n for (let i = 0; i < this._activeBoundingBoxes.length; i++) {\r\n const boundingBox = this._activeBoundingBoxes.data[i];\r\n boundingBoxRenderer.renderList.push(boundingBox);\r\n }\r\n }\r\n\r\n return currentRenderList;\r\n }\r\n\r\n this._renderingManager.reset();\r\n this._activeMeshes.reset();\r\n this._activeBoundingBoxes.reset();\r\n\r\n // We do not check option.enableBoundingBoxRendering before resetting the current list of bounding boxes, because:\r\n // * if bounding box rendering is enabled, we want to start with an empty list and add new bounding boxes to it\r\n // * if bounding box rendering is disabled, we don't want to render any bounding boxes that may have been generated by previous code\r\n boundingBoxRenderer && boundingBoxRenderer.reset();\r\n\r\n if (this.renderMeshes) {\r\n const sceneRenderId = scene.getRenderId();\r\n const currentFrameId = scene.getFrameId();\r\n for (let meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {\r\n const mesh = currentRenderList[meshIndex];\r\n\r\n if (mesh && !mesh.isBlocked) {\r\n if (this.customIsReadyFunction) {\r\n if (!this.customIsReadyFunction(mesh, this.refreshRate, false)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n } else if (!mesh.isReady(this.refreshRate === 0)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n\r\n let meshToRender: Nullable<AbstractMesh>;\r\n\r\n if (cameraForLOD) {\r\n const meshToRenderAndFrameId = mesh._internalAbstractMeshDataInfo._currentLOD.get(cameraForLOD);\r\n if (!meshToRenderAndFrameId || meshToRenderAndFrameId[1] !== currentFrameId) {\r\n meshToRender = scene.customLODSelector ? scene.customLODSelector(mesh, cameraForLOD) : mesh.getLOD(cameraForLOD);\r\n if (!meshToRenderAndFrameId) {\r\n mesh._internalAbstractMeshDataInfo._currentLOD.set(cameraForLOD, [meshToRender, currentFrameId]);\r\n } else {\r\n meshToRenderAndFrameId[0] = meshToRender;\r\n meshToRenderAndFrameId[1] = currentFrameId;\r\n }\r\n } else {\r\n meshToRender = meshToRenderAndFrameId[0];\r\n }\r\n } else {\r\n meshToRender = mesh;\r\n }\r\n\r\n if (!meshToRender) {\r\n continue;\r\n }\r\n\r\n if (meshToRender !== mesh && meshToRender.billboardMode !== 0) {\r\n meshToRender.computeWorldMatrix(); // Compute world matrix if LOD is billboard\r\n }\r\n\r\n meshToRender._preActivateForIntermediateRendering(sceneRenderId);\r\n\r\n let isMasked;\r\n if (checkLayerMask && camera) {\r\n isMasked = (mesh.layerMask & camera.layerMask) === 0;\r\n } else {\r\n isMasked = false;\r\n }\r\n\r\n if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {\r\n this._activeMeshes.push(mesh);\r\n meshToRender._internalAbstractMeshDataInfo._wasActiveLastFrame = true;\r\n\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(sceneRenderId, true);\r\n }\r\n\r\n this.enableBoundingBoxRendering && boundingBoxRenderer && boundingBoxRenderer._preActiveMesh(mesh);\r\n\r\n if (mesh._activate(sceneRenderId, true) && mesh.subMeshes.length) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;\r\n } else {\r\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\r\n meshToRender = mesh;\r\n }\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActiveIntermediate = true;\r\n\r\n scene._prepareSkeleton(meshToRender);\r\n\r\n for (let subIndex = 0; subIndex < meshToRender.subMeshes.length; subIndex++) {\r\n const subMesh = meshToRender.subMeshes[subIndex];\r\n this.enableBoundingBoxRendering && boundingBoxRenderer && boundingBoxRenderer._evaluateSubMesh(mesh, subMesh);\r\n this._renderingManager.dispatch(subMesh, meshToRender);\r\n }\r\n }\r\n\r\n mesh._postActivate();\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (this.enableBoundingBoxRendering && boundingBoxRenderer && winterIsComing) {\r\n for (let i = 0; i < boundingBoxRenderer.renderList.length; i++) {\r\n const boundingBox = boundingBoxRenderer.renderList.data[i];\r\n this._activeBoundingBoxes.push(boundingBox);\r\n }\r\n }\r\n\r\n if (this._scene.particlesEnabled && this.renderParticles) {\r\n this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);\r\n const particleSystems = this.particleSystemList || scene.particleSystems;\r\n for (let particleIndex = 0; particleIndex < particleSystems.length; particleIndex++) {\r\n const particleSystem = particleSystems[particleIndex];\r\n\r\n const emitter: any = particleSystem.emitter;\r\n\r\n if (!particleSystem.isStarted() || !emitter || (emitter.position && !emitter.isEnabled())) {\r\n continue;\r\n }\r\n\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene);\r\n }\r\n\r\n return currentRenderList;\r\n }\r\n\r\n /**\r\n * Gets the rendering manager\r\n */\r\n public get renderingManager(): RenderingManager {\r\n return this._renderingManager;\r\n }\r\n\r\n /**\r\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversely depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n public setRenderingOrder(\r\n renderingGroupId: number,\r\n opaqueSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n alphaTestSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n transparentSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null\r\n ): void {\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n }\r\n\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n public setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth = true, stencil = true): void {\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\r\n this._renderingManager._useSceneAutoClearSetup = false;\r\n }\r\n\r\n /**\r\n * Clones the renderer.\r\n * @returns the cloned renderer\r\n */\r\n public clone(): ObjectRenderer {\r\n const newRenderer = new ObjectRenderer(this.name, this._scene, this.options);\r\n\r\n if (this.renderList) {\r\n newRenderer.renderList = this.renderList.slice(0);\r\n }\r\n\r\n return newRenderer;\r\n }\r\n\r\n /**\r\n * Dispose the renderer and release its associated resources.\r\n */\r\n public dispose(): void {\r\n const renderList = this.renderList ? this.renderList : this._scene.getActiveMeshes().data;\r\n const renderListLength = this.renderList ? this.renderList.length : this._scene.getActiveMeshes().length;\r\n for (let i = 0; i < renderListLength; i++) {\r\n const mesh = renderList[i];\r\n if (mesh && mesh.getMaterialForRenderPass(this.renderPassId) !== undefined) {\r\n mesh.setMaterialForRenderPass(this.renderPassId, undefined);\r\n }\r\n }\r\n\r\n this.onInitRenderingObservable.clear();\r\n this.onFinishRenderingObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderingManagerRenderObservable.clear();\r\n this.onAfterRenderingManagerRenderObservable.clear();\r\n this.onFastPathRenderObservable.clear();\r\n\r\n this._releaseRenderPassId();\r\n\r\n this.renderList = null;\r\n if (this._sceneUBOs) {\r\n for (const ubo of this._sceneUBOs) {\r\n ubo.dispose();\r\n }\r\n }\r\n this._sceneUBOs = undefined as any;\r\n\r\n this._scene.removeObjectRenderer(this);\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this.refreshRate === ObjectRenderer.REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = ObjectRenderer.REFRESHRATE_RENDER_ONCE;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the info related to rendering groups preventing retention point in material dispose.\r\n */\r\n public freeRenderingGroups(): void {\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"objectRenderer.js","sourceRoot":"","sources":["../../../../dev/core/src/Rendering/objectRenderer.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAiB1D;;;GAGG;AACH,MAAM,OAAO,cAAc;IAwBvB;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAoC;QACtD,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;YAC7B,OAAO;QACX,CAAC;QACD,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACrC,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,oBAAoB,GAA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,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,wCAAwC,CAAC,KAAK,EAAE,CAAC;QACtD,IAAI,CAAC,uCAAuC,CAAC,KAAK,EAAE,CAAC;QACrD,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;QAExC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChC,GAAG,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;QACL,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,SAAgB,CAAC;QAEnC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,gBAAgB;IACT,QAAQ;QACX,IAAI,IAAI,CAAC,WAAW,KAAK,cAAc,CAAC,uBAAuB,EAAE,CAAC;YAC9D,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,uBAAuB,CAAC;QAC9D,CAAC;IACL,CAAC;IAED;;OAEG;IACI,mBAAmB;QACtB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QACjD,CAAC;IACL,CAAC;;AAzjCD;;GAEG;AACoB,sCAAuB,GAAW,CAAC,AAAZ,CAAa;AAC3D;;GAEG;AACoB,8CAA+B,GAAW,CAAC,AAAZ,CAAa;AACnE;;;GAGG;AACoB,kDAAmC,GAAW,CAAC,AAAZ,CAAa","sourcesContent":["import {\r\n type Nullable,\r\n type Immutable,\r\n type Camera,\r\n type Scene,\r\n type AbstractMesh,\r\n type SubMesh,\r\n type Material,\r\n type IParticleSystem,\r\n type InstancedMesh,\r\n type BoundingBox,\r\n type BoundingBoxRenderer,\r\n type AbstractEngine,\r\n type ClusteredLightContainer,\r\n} from \"core/index\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { RenderingManager } from \"../Rendering/renderingManager\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { _ObserveArray } from \"../Misc/arrayTools\";\r\nimport { _RetryWithInterval } from \"../Misc/timingTools\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { LightConstants } from \"../Lights/lightConstants\";\r\n\r\n/**\r\n * Defines the options of the object renderer\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface ObjectRendererOptions {\r\n /** The number of passes the renderer will support (1 by default) */\r\n numPasses?: number;\r\n\r\n /** True (default) to not change the aspect ratio of the scene in the RTT */\r\n doNotChangeAspectRatio?: boolean;\r\n\r\n /** True to enable clustered lights (default: false) */\r\n enableClusteredLights?: boolean;\r\n}\r\n\r\n/**\r\n * A class that renders objects to the currently bound render target.\r\n * This class only renders objects, and is not concerned with the output texture or post-processing.\r\n */\r\nexport class ObjectRenderer {\r\n /**\r\n * Objects will only be rendered once which can be useful to improve performance if everything in your render is static for instance.\r\n */\r\n public static readonly REFRESHRATE_RENDER_ONCE: number = 0;\r\n /**\r\n * Objects will be rendered every frame and is recommended for dynamic contents.\r\n */\r\n public static readonly REFRESHRATE_RENDER_ONEVERYFRAME: number = 1;\r\n /**\r\n * Objects will be rendered every 2 frames which could be enough if your dynamic objects are not\r\n * the central point of your effect and can save a lot of performances.\r\n */\r\n public static readonly REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number = 2;\r\n\r\n /**\r\n * Use this predicate to dynamically define the list of mesh you want to render.\r\n * If set, the renderList property will be overwritten.\r\n */\r\n public renderListPredicate: (AbstractMesh: AbstractMesh) => boolean;\r\n\r\n private _renderList: Nullable<Array<AbstractMesh>>;\r\n private _unObserveRenderList: Nullable<() => void> = null;\r\n\r\n /**\r\n * Use this list to define the list of mesh you want to render.\r\n */\r\n public get renderList(): Nullable<Array<AbstractMesh>> {\r\n return this._renderList;\r\n }\r\n\r\n public set renderList(value: Nullable<Array<AbstractMesh>>) {\r\n if (this._renderList === value) {\r\n return;\r\n }\r\n if (this._unObserveRenderList) {\r\n this._unObserveRenderList();\r\n this._unObserveRenderList = null;\r\n }\r\n\r\n if (value) {\r\n this._unObserveRenderList = _ObserveArray(value, this._renderListHasChanged);\r\n }\r\n\r\n this._renderList = value;\r\n }\r\n\r\n private _renderListHasChanged = (_functionName: string, previousLength: number) => {\r\n const newLength = this._renderList ? this._renderList.length : 0;\r\n if ((previousLength === 0 && newLength > 0) || newLength === 0) {\r\n for (const mesh of this._scene.meshes) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * Define the list of particle systems to render. If not provided, will render all the particle systems of the scene.\r\n * Note that the particle systems are rendered only if renderParticles is set to true.\r\n */\r\n public particleSystemList: Nullable<Array<IParticleSystem>> = null;\r\n\r\n /**\r\n * Use this function to overload the renderList array at rendering time.\r\n * Return null to render with the current renderList, else return the list of meshes to use for rendering.\r\n * For 2DArray, layerOrFace is the index of the layer that is going to be rendered, else it is the faceIndex of\r\n * the cube (if the RTT is a cube, else layerOrFace=0).\r\n * The renderList passed to the function is the current render list (the one that will be used if the function returns null).\r\n * The length of this list is passed through renderListLength: don't use renderList.length directly because the array can\r\n * hold dummy elements!\r\n */\r\n public getCustomRenderList: Nullable<(layerOrFace: number, renderList: Nullable<Immutable<Array<AbstractMesh>>>, renderListLength: number) => Nullable<Array<AbstractMesh>>> =\r\n null;\r\n\r\n /**\r\n * Define if meshes should be rendered (default is true).\r\n */\r\n public renderMeshes = true;\r\n\r\n /**\r\n * Define if depth only meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderDepthOnlyMeshes = true;\r\n\r\n /**\r\n * Define if opaque meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderOpaqueMeshes = true;\r\n\r\n /**\r\n * Define if alpha test meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderAlphaTestMeshes = true;\r\n\r\n /**\r\n * Define if transparent meshes should be rendered (default is true). No effect if renderMeshes is false.\r\n */\r\n public renderTransparentMeshes = true;\r\n\r\n /**\r\n * Custom render function for transparent submeshes.\r\n */\r\n public customRenderTransparentSubMeshes?: (transparentSubMeshes: SmartArray<SubMesh>) => void;\r\n\r\n /**\r\n * Define if particles should be rendered (default is true).\r\n */\r\n public renderParticles = true;\r\n\r\n /**\r\n * Define if sprites should be rendered (default is false).\r\n */\r\n public renderSprites = false;\r\n\r\n /**\r\n * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined)\r\n */\r\n public forceLayerMaskCheck = false;\r\n\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is false.\r\n */\r\n public enableBoundingBoxRendering = false;\r\n\r\n /**\r\n * Enables the rendering of outline/overlay for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public enableOutlineRendering = true;\r\n\r\n /**\r\n * Define the camera used to render the objects.\r\n */\r\n public activeCamera: Nullable<Camera>;\r\n\r\n /**\r\n * Define the camera used to calculate the LOD of the objects.\r\n * If not defined, activeCamera will be used. If not defined nor activeCamera, scene's active camera will be used.\r\n */\r\n public cameraForLOD: Nullable<Camera>;\r\n\r\n private _disableImageProcessing = false;\r\n /**\r\n * If true, the object renderer will render all objects without any image processing applied.\r\n * If false (default value), the renderer will use the current setting of the scene's image processing configuration.\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_ImageProcessingDirtyFlag);\r\n }\r\n\r\n /**\r\n * If true, the object renderer will not set the view/projection/transformation matrices for the active camera (default: false).\r\n * By default, the view/projection/transformation matrices are set from the active camera (either ObjectRenderer.activeCamera or scene.activeCamera).\r\n * Sets this property to true if you want to define your own transformation matrices (use the onInitRenderingObservable observable\r\n * to set your own matrices, to be sure they will be correctly taken into account)\r\n */\r\n public dontSetTransformationMatrix = false;\r\n\r\n private _disableDepthPrePass = false;\r\n /**\r\n * Specifies to disable depth pre-pass if true (default: false)\r\n */\r\n public get disableDepthPrePass() {\r\n return this._disableDepthPrePass;\r\n }\r\n\r\n public set disableDepthPrePass(value: boolean) {\r\n this._disableDepthPrePass = value;\r\n this._renderingManager.disableDepthPrePass = value;\r\n }\r\n\r\n /**\r\n * Override the mesh isReady function with your own one.\r\n */\r\n public customIsReadyFunction: (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => boolean;\r\n\r\n /**\r\n * Override the render function with your own one.\r\n */\r\n public customRenderFunction: (\r\n opaqueSubMeshes: SmartArray<SubMesh>,\r\n alphaTestSubMeshes: SmartArray<SubMesh>,\r\n transparentSubMeshes: SmartArray<SubMesh>,\r\n depthOnlySubMeshes: SmartArray<SubMesh>,\r\n beforeTransparents?: () => void\r\n ) => void;\r\n\r\n /**\r\n * An event triggered before rendering the objects.\r\n * Note: This observable is also triggered during readiness checks (e.g. when calling scene.isReady()),\r\n * in which case the render target is not bound to the output. Observers should avoid performing\r\n * GPU state changes (such as clearing or modifying the framebuffer) unless the render target is actually bound.\r\n */\r\n public readonly onBeforeRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered after rendering the objects.\r\n * Note: This observable is also triggered during readiness checks (e.g. when calling scene.isReady()),\r\n * in which case the render target is not bound to the output. Observers should avoid performing\r\n * GPU state changes (such as clearing or modifying the framebuffer) unless the render target is actually bound.\r\n */\r\n public readonly onAfterRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered before the rendering group is processed\r\n */\r\n public readonly onBeforeRenderingManagerRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered after the rendering group is processed\r\n */\r\n public readonly onAfterRenderingManagerRenderObservable = new Observable<number>();\r\n\r\n /**\r\n * An event triggered when initRender is called\r\n */\r\n public readonly onInitRenderingObservable = new Observable<ObjectRenderer>();\r\n\r\n /**\r\n * An event triggered when finishRender is called\r\n */\r\n public readonly onFinishRenderingObservable = new Observable<ObjectRenderer>();\r\n\r\n /**\r\n * An event triggered when fast path rendering is used\r\n */\r\n public readonly onFastPathRenderObservable = new Observable<number>();\r\n\r\n protected _engine: AbstractEngine;\r\n protected _scene: Scene;\r\n protected _renderingManager: RenderingManager;\r\n /** @internal */\r\n public _waitingRenderList?: string[];\r\n protected _currentRefreshId = -1;\r\n protected _refreshRate = 1;\r\n protected _currentApplyByPostProcessSetting = false;\r\n protected _activeMeshes = new SmartArray<AbstractMesh>(256);\r\n protected _activeBoundingBoxes = new SmartArray<BoundingBox>(32);\r\n protected _useUBO: boolean;\r\n protected _sceneUBOs: UniformBuffer[]; // It's an array because we may need multiple ubos per frame if the object renderer is used several times in a frame (e.g. for rigged cameras)\r\n protected _sceneUBOIsMultiview: boolean[]; // Parallel array caching the multiview state per UBO slot — avoids getUniformNames().indexOf() in the hot path\r\n protected _currentSceneUBO: UniformBuffer;\r\n protected _currentFrameId = -1;\r\n protected _currentSceneUBOIndex = 0;\r\n\r\n /**\r\n * The options used by the object renderer\r\n */\r\n public options: Required<ObjectRendererOptions>;\r\n\r\n private _name: string;\r\n /**\r\n * Friendly name of the object renderer\r\n */\r\n public get name() {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n if (this._name === value) {\r\n return;\r\n }\r\n\r\n this._name = value;\r\n if (this._sceneUBOs) {\r\n for (let i = 0; i < this._sceneUBOs.length; ++i) {\r\n this._sceneUBOs[i].name = `Scene ubo #${i} for ${this.name}`;\r\n }\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < this._renderPassIds.length; ++i) {\r\n const renderPassId = this._renderPassIds[i];\r\n this._engine._renderPassNames[renderPassId] = `${this._name}#${i}`;\r\n }\r\n }\r\n\r\n /**\r\n * Current render pass id. Note it can change over the rendering as there's a separate id for each face of a cube / each layer of an array layer!\r\n */\r\n public renderPassId: number;\r\n private readonly _renderPassIds: number[];\r\n /**\r\n * Gets the render pass ids used by the object renderer.\r\n */\r\n public get renderPassIds(): readonly number[] {\r\n return this._renderPassIds;\r\n }\r\n\r\n /**\r\n * Gets the current value of the refreshId counter\r\n */\r\n public get currentRefreshId() {\r\n return this._currentRefreshId;\r\n }\r\n\r\n /**\r\n * Gets the array of active meshes\r\n * @returns an array of AbstractMesh\r\n */\r\n public getActiveMeshes(): SmartArray<AbstractMesh> {\r\n return this._activeMeshes;\r\n }\r\n\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes with this object renderer\r\n * @param mesh mesh or array of meshes\r\n * @param material material or array of materials to use for this render pass. If undefined is passed, no specific material will be used but the regular material instead (mesh.material). It's possible to provide an array of materials to use a different material for each rendering pass.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material | Material[]): void {\r\n let meshes;\r\n if (!Array.isArray(mesh)) {\r\n meshes = [mesh];\r\n } else {\r\n meshes = mesh;\r\n }\r\n for (let j = 0; j < meshes.length; ++j) {\r\n for (let i = 0; i < this.options.numPasses; ++i) {\r\n let mesh = meshes[j];\r\n if (meshes[j].isAnInstance) {\r\n mesh = (meshes[j] as InstancedMesh).sourceMesh;\r\n }\r\n mesh.setMaterialForRenderPass(this._renderPassIds[i], material !== undefined ? (Array.isArray(material) ? material[i] : material) : undefined);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _isFrozen = false;\r\n\r\n /** @internal */\r\n public _freezeActiveMeshesCancel: Nullable<() => void> = null;\r\n\r\n /** @internal */\r\n public _freezeActiveMeshes(freezeMeshes: boolean) {\r\n this._freezeActiveMeshesCancel = _RetryWithInterval(\r\n () => {\r\n return this._checkReadiness();\r\n },\r\n () => {\r\n this._freezeActiveMeshesCancel = null;\r\n if (freezeMeshes) {\r\n for (let index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._freeze();\r\n }\r\n }\r\n this._prepareRenderingManager(0, true);\r\n this._isFrozen = true;\r\n },\r\n (err, isTimeout) => {\r\n this._freezeActiveMeshesCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"ObjectRenderer: An unexpected error occurred while waiting for the renderer to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(`ObjectRenderer: Timeout while waiting for the renderer to be ready.`);\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n }\r\n );\r\n }\r\n\r\n /** @internal */\r\n public _unfreezeActiveMeshes() {\r\n this._freezeActiveMeshesCancel?.();\r\n this._freezeActiveMeshesCancel = null;\r\n for (let index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._unFreeze();\r\n }\r\n this._isFrozen = false;\r\n }\r\n\r\n /**\r\n * Instantiates an object renderer.\r\n * @param name The friendly name of the object renderer\r\n * @param scene The scene the renderer belongs to\r\n * @param options The options used to create the renderer (optional)\r\n */\r\n constructor(name: string, scene: Scene, options?: ObjectRendererOptions) {\r\n this.name = name;\r\n this._scene = scene;\r\n this._engine = this._scene.getEngine();\r\n this._useUBO = this._engine.supportsUniformBuffers;\r\n\r\n this.renderList = [] as AbstractMesh[];\r\n this._renderPassIds = [];\r\n\r\n this.options = {\r\n numPasses: 1,\r\n doNotChangeAspectRatio: true,\r\n enableClusteredLights: false,\r\n ...options,\r\n };\r\n\r\n this._createRenderPassId();\r\n\r\n this.renderPassId = this._renderPassIds[0];\r\n\r\n // Rendering groups\r\n this._renderingManager = new RenderingManager(scene);\r\n this._renderingManager._useSceneAutoClearSetup = true;\r\n\r\n if (this.options.enableClusteredLights) {\r\n this.onInitRenderingObservable.add(() => {\r\n for (const light of this._scene.lights) {\r\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_CLUSTERED_CONTAINER && (light as ClusteredLightContainer).isSupported) {\r\n (light as ClusteredLightContainer)._updateBatches(this.activeCamera).render();\r\n }\r\n }\r\n });\r\n }\r\n\r\n this._scene.addObjectRenderer(this);\r\n }\r\n\r\n private _releaseRenderPassId(): void {\r\n for (let i = 0; i < this.options.numPasses; ++i) {\r\n this._engine.releaseRenderPassId(this._renderPassIds[i]);\r\n }\r\n this._renderPassIds.length = 0;\r\n }\r\n\r\n private _createRenderPassId(): void {\r\n this._releaseRenderPassId();\r\n\r\n for (let i = 0; i < this.options.numPasses; ++i) {\r\n this._renderPassIds[i] = this._engine.createRenderPassId(`${this.name}#${i}`);\r\n }\r\n }\r\n\r\n private _createSceneUBO(name: string, isMultiview: boolean): UniformBuffer {\r\n const engine = this._scene.getEngine();\r\n const ubo = new UniformBuffer(engine, undefined, isMultiview, name, undefined, false);\r\n ubo.addUniform(\"viewProjection\", 16);\r\n if (isMultiview) {\r\n ubo.addUniform(\"viewProjectionR\", 16);\r\n }\r\n ubo.addUniform(\"view\", 16);\r\n ubo.addUniform(\"projection\", 16);\r\n ubo.addUniform(\"vEyePosition\", 4);\r\n ubo.addUniform(\"inverseProjection\", 16);\r\n return ubo;\r\n }\r\n\r\n private _getSceneUBO(): UniformBuffer {\r\n if (this._currentFrameId !== this._engine.frameId) {\r\n this._currentSceneUBOIndex = 0;\r\n this._currentFrameId = this._engine.frameId;\r\n }\r\n\r\n if (!this._sceneUBOs) {\r\n this._sceneUBOs = [];\r\n this._sceneUBOIsMultiview = [];\r\n }\r\n\r\n const activeRenderTarget = this._engine._currentRenderTarget;\r\n const isMultiview = !!(activeRenderTarget && activeRenderTarget.texture?.isMultiview) || !!(this._scene as any)._multiviewSceneUboIsActive;\r\n\r\n // Check if we have enough UBOs or if the current one is compatible\r\n if (this._currentSceneUBOIndex >= this._sceneUBOs.length) {\r\n const index = this._sceneUBOs.length;\r\n this._sceneUBOs.push(this._createSceneUBO(`Scene ubo #${index} for ${this.name}`, isMultiview));\r\n this._sceneUBOIsMultiview.push(isMultiview);\r\n } else if (this._sceneUBOIsMultiview[this._currentSceneUBOIndex] !== isMultiview) {\r\n // Layout mismatch, recreate\r\n this._sceneUBOs[this._currentSceneUBOIndex].dispose();\r\n this._sceneUBOs[this._currentSceneUBOIndex] = this._createSceneUBO(`Scene ubo #${this._currentSceneUBOIndex} for ${this.name}`, isMultiview);\r\n this._sceneUBOIsMultiview[this._currentSceneUBOIndex] = isMultiview;\r\n }\r\n\r\n const ubo = this._sceneUBOs[this._currentSceneUBOIndex++];\r\n ubo.unbindEffect();\r\n\r\n return ubo;\r\n }\r\n\r\n /**\r\n * Resets the refresh counter of the renderer and start back from scratch.\r\n * Could be useful to re-render if it is setup to render only once.\r\n */\r\n public resetRefreshCounter(): void {\r\n this._currentRefreshId = -1;\r\n }\r\n\r\n /**\r\n * Defines the refresh rate of the rendering or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n public get refreshRate(): number {\r\n return this._refreshRate;\r\n }\r\n public set refreshRate(value: number) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n }\r\n\r\n /**\r\n * Indicates if the renderer should render the current frame.\r\n * The output is based on the specified refresh rate.\r\n * When snapshot rendering is active, this always returns true to ensure render pass\r\n * topology stays consistent between the recording frame and playback frames.\r\n * @returns true if the renderer should render the current frame\r\n */\r\n public shouldRender(): boolean {\r\n if (this._engine.snapshotRendering) {\r\n // When snapshot rendering is active (recording or playing), we must always render\r\n // to ensure the number of render passes stays consistent between the recording frame\r\n // and all playback frames. If a render target is skipped during recording but not\r\n // during playback (or vice versa), the recorded bundle list indices become misaligned,\r\n // causing visual artifacts such as flickering.\r\n return true;\r\n }\r\n\r\n if (this._currentRefreshId === -1) {\r\n // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n\r\n this._currentRefreshId++;\r\n return false;\r\n }\r\n\r\n /**\r\n * This function will check if the renderer is ready to render (textures are loaded, shaders are compiled)\r\n * @param viewportWidth defines the width of the viewport\r\n * @param viewportHeight defines the height of the viewport\r\n * @returns true if all required resources are ready\r\n */\r\n public isReadyForRendering(viewportWidth: number, viewportHeight: number): boolean {\r\n this.prepareRenderList();\r\n this.initRender(viewportWidth, viewportHeight);\r\n\r\n const isReady = this._checkReadiness();\r\n\r\n this.finishRender();\r\n\r\n return isReady;\r\n }\r\n\r\n /**\r\n * Makes sure the list of meshes is ready to be rendered\r\n * You should call this function before \"initRender\", but if you know the render list is ok, you may call \"initRender\" directly\r\n */\r\n public prepareRenderList(): void {\r\n const scene = this._scene;\r\n\r\n if (this._waitingRenderList) {\r\n if (!this.renderListPredicate) {\r\n this.renderList = [];\r\n for (let index = 0; index < this._waitingRenderList.length; index++) {\r\n const id = this._waitingRenderList[index];\r\n const mesh = scene.getMeshById(id);\r\n if (mesh) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n this._waitingRenderList = undefined;\r\n }\r\n\r\n // Is predicate defined?\r\n if (this.renderListPredicate) {\r\n if (this.renderList) {\r\n this.renderList.length = 0; // Clear previous renderList\r\n } else {\r\n this.renderList = [];\r\n }\r\n\r\n const sceneMeshes = this._scene.meshes;\r\n\r\n for (let index = 0; index < sceneMeshes.length; index++) {\r\n const mesh = sceneMeshes[index];\r\n if (this.renderListPredicate(mesh)) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n\r\n this._currentApplyByPostProcessSetting = this._scene.imageProcessingConfiguration.applyByPostProcess;\r\n if (this._disableImageProcessing) {\r\n // we do not use the applyByPostProcess setter to avoid flagging all the materials as \"image processing dirty\"!\r\n this._scene.imageProcessingConfiguration._applyByPostProcess = this._disableImageProcessing;\r\n }\r\n }\r\n\r\n private _defaultRenderListPrepared: boolean;\r\n private _currentSceneCamera: Nullable<Camera> = null;\r\n\r\n /**\r\n * This method makes sure everything is setup before \"render\" can be called\r\n * @param viewportWidth Width of the viewport to render to\r\n * @param viewportHeight Height of the viewport to render to\r\n */\r\n public initRender(viewportWidth: number, viewportHeight: number): void {\r\n const camera: Nullable<Camera> = this.activeCamera ?? this._scene.activeCamera;\r\n\r\n this._currentSceneCamera = this._scene.activeCamera;\r\n\r\n if (this._useUBO) {\r\n this._currentSceneUBO = this._scene.getSceneUniformBuffer();\r\n this._currentSceneUBO.unbindEffect();\r\n this._scene.setSceneUniformBuffer(this._getSceneUBO());\r\n }\r\n\r\n this.onInitRenderingObservable.notifyObservers(this);\r\n\r\n if (camera) {\r\n if (!this.dontSetTransformationMatrix) {\r\n this._scene.setTransformMatrix(camera.getViewMatrix(), camera.getProjectionMatrix(true));\r\n }\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged for this internal render pass.\r\n this._scene._activeCamera = camera;\r\n this._engine.setViewport(camera.rigParent ? camera.rigParent.viewport : camera.viewport, viewportWidth, viewportHeight);\r\n }\r\n\r\n if (this._useUBO) {\r\n this._scene.finalizeSceneUbo();\r\n }\r\n\r\n this._defaultRenderListPrepared = false;\r\n }\r\n\r\n /**\r\n * This method must be called after the \"render\" call(s), to complete the rendering process.\r\n */\r\n public finishRender() {\r\n const scene = this._scene;\r\n\r\n if (this._useUBO) {\r\n this._scene.setSceneUniformBuffer(this._currentSceneUBO);\r\n }\r\n\r\n if (this._disableImageProcessing) {\r\n scene.imageProcessingConfiguration._applyByPostProcess = this._currentApplyByPostProcessSetting;\r\n }\r\n\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged for this internal render pass.\r\n scene._activeCamera = this._currentSceneCamera;\r\n if (this._currentSceneCamera) {\r\n if (this.activeCamera && this.activeCamera !== scene.activeCamera) {\r\n scene.setTransformMatrix(this._currentSceneCamera.getViewMatrix(), this._currentSceneCamera.getProjectionMatrix(true));\r\n }\r\n this._engine.setViewport(this._currentSceneCamera.viewport);\r\n }\r\n\r\n scene.resetCachedMaterial();\r\n\r\n this.onFinishRenderingObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Renders all the objects (meshes, particles systems, sprites) to the currently bound render target texture.\r\n * @param passIndex defines the pass index to use (default: 0)\r\n * @param skipOnAfterRenderObservable defines a flag to skip raising the onAfterRenderObservable\r\n */\r\n public render(passIndex = 0, skipOnAfterRenderObservable = false): void {\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n\r\n this._engine.currentRenderPassId = this._renderPassIds[passIndex];\r\n\r\n this.onBeforeRenderObservable.notifyObservers(passIndex);\r\n\r\n const fastPath = this._engine.snapshotRendering && this._engine.snapshotRenderingMode === Constants.SNAPSHOTRENDERING_FAST;\r\n\r\n if (!fastPath) {\r\n const currentRenderList = this._prepareRenderingManager(passIndex);\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import outlineRenderer\r\n const outlineRenderer = (this._scene as any).getOutlineRenderer?.();\r\n const outlineRendererIsEnabled = outlineRenderer?.enabled;\r\n\r\n if (outlineRenderer) {\r\n outlineRenderer.enabled = this.enableOutlineRendering;\r\n }\r\n\r\n this.onBeforeRenderingManagerRenderObservable.notifyObservers(passIndex);\r\n\r\n this._renderingManager.render(\r\n this.customRenderFunction,\r\n currentRenderList,\r\n this.renderParticles,\r\n this.renderSprites,\r\n this.renderDepthOnlyMeshes,\r\n this.renderOpaqueMeshes,\r\n this.renderAlphaTestMeshes,\r\n this.renderTransparentMeshes,\r\n this.customRenderTransparentSubMeshes\r\n );\r\n this.onAfterRenderingManagerRenderObservable.notifyObservers(passIndex);\r\n\r\n if (outlineRenderer) {\r\n outlineRenderer.enabled = outlineRendererIsEnabled;\r\n }\r\n } else {\r\n this.onFastPathRenderObservable.notifyObservers(passIndex);\r\n }\r\n\r\n if (!skipOnAfterRenderObservable) {\r\n this.onAfterRenderObservable.notifyObservers(passIndex);\r\n }\r\n\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n }\r\n\r\n /** @internal */\r\n public _checkReadiness(): boolean {\r\n const scene = this._scene;\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n\r\n let returnValue = true;\r\n\r\n if (!scene.getViewMatrix()) {\r\n // We probably didn't execute scene.render() yet, so make sure we have a view/projection matrix setup for the scene\r\n scene.updateTransformMatrix();\r\n }\r\n\r\n const numPasses = this.options.numPasses;\r\n for (let passIndex = 0; passIndex < numPasses && returnValue; passIndex++) {\r\n const defaultRenderList = this.renderList ? this.renderList : scene.frameGraph ? scene.meshes : scene.getActiveMeshes().data;\r\n const defaultRenderListLength = this.renderList || scene.frameGraph ? defaultRenderList.length : scene.getActiveMeshes().length;\r\n\r\n this._engine.currentRenderPassId = this._renderPassIds[passIndex];\r\n\r\n this.onBeforeRenderObservable.notifyObservers(passIndex);\r\n\r\n let currentRenderList: Nullable<Array<AbstractMesh>> = null;\r\n let currentRenderListLength = defaultRenderListLength;\r\n\r\n if (this.getCustomRenderList) {\r\n currentRenderList = this.getCustomRenderList(passIndex, defaultRenderList, defaultRenderListLength);\r\n if (currentRenderList) {\r\n currentRenderListLength = currentRenderList.length;\r\n }\r\n }\r\n\r\n if (!currentRenderList) {\r\n currentRenderList = defaultRenderList;\r\n }\r\n\r\n if (!this.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n\r\n for (let i = 0; i < currentRenderListLength && returnValue; ++i) {\r\n const mesh = currentRenderList[i];\r\n\r\n if (!mesh.isEnabled() || mesh.isBlocked || !mesh.isVisible || !mesh.subMeshes) {\r\n continue;\r\n }\r\n\r\n if (this.customIsReadyFunction) {\r\n if (!this.customIsReadyFunction(mesh, this.refreshRate, true)) {\r\n returnValue = false;\r\n continue;\r\n }\r\n } else if (!mesh.isReady(true)) {\r\n returnValue = false;\r\n continue;\r\n }\r\n }\r\n\r\n this.onAfterRenderObservable.notifyObservers(passIndex);\r\n\r\n if (numPasses > 1) {\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n\r\n const particleSystems = this.particleSystemList || scene.particleSystems;\r\n for (const particleSystem of particleSystems) {\r\n if (!particleSystem.isReady()) {\r\n returnValue = false;\r\n }\r\n }\r\n\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n\r\n return returnValue;\r\n }\r\n\r\n private _prepareRenderingManager(passIndex = 0, winterIsComing = false): Array<AbstractMesh> {\r\n const scene = this._scene;\r\n\r\n // Get the list of meshes to dispatch to the rendering manager\r\n let currentRenderList: Nullable<Array<AbstractMesh>> = null;\r\n let currentRenderListLength: number;\r\n let checkLayerMask: boolean;\r\n\r\n const defaultRenderList = this.renderList ? this.renderList : scene.frameGraph ? scene.meshes : scene.getActiveMeshes().data;\r\n const defaultRenderListLength = this.renderList || scene.frameGraph ? defaultRenderList.length : scene.getActiveMeshes().length;\r\n\r\n if (this.getCustomRenderList) {\r\n currentRenderList = this.getCustomRenderList(passIndex, defaultRenderList, defaultRenderListLength);\r\n }\r\n\r\n if (!currentRenderList) {\r\n // No custom render list provided, we prepare the rendering for the default list, but check\r\n // first if we did not already performed the preparation (in this frame) before so as to avoid re-doing it several times.\r\n // In WebGPU, instance data (visibleInstances) is stored per render pass ID. Each cascade/face (in CSM) uses a different\r\n // render pass ID, so we must re-prepare for each pass to register instances in the correct per-pass storage.\r\n if (this._defaultRenderListPrepared && !winterIsComing && !this._engine.isWebGPU) {\r\n return defaultRenderList;\r\n }\r\n this._defaultRenderListPrepared = true;\r\n currentRenderList = defaultRenderList;\r\n currentRenderListLength = defaultRenderListLength;\r\n checkLayerMask = !this.renderList || this.forceLayerMaskCheck;\r\n } else {\r\n // Prepare the rendering for the custom render list provided\r\n currentRenderListLength = currentRenderList.length;\r\n checkLayerMask = this.forceLayerMaskCheck;\r\n }\r\n\r\n const camera = scene.activeCamera; // note that at this point, scene.activeCamera == this.activeCamera if defined, because initRender() has been called before\r\n const cameraForLOD = this.cameraForLOD ?? camera;\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (scene as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n if (scene._activeMeshesFrozen && this._isFrozen) {\r\n this._renderingManager.resetSprites();\r\n\r\n if (this.enableBoundingBoxRendering && boundingBoxRenderer) {\r\n boundingBoxRenderer.reset();\r\n for (let i = 0; i < this._activeBoundingBoxes.length; i++) {\r\n const boundingBox = this._activeBoundingBoxes.data[i];\r\n boundingBoxRenderer.renderList.push(boundingBox);\r\n }\r\n }\r\n\r\n return currentRenderList;\r\n }\r\n\r\n this._renderingManager.reset();\r\n this._activeMeshes.reset();\r\n this._activeBoundingBoxes.reset();\r\n\r\n // We do not check option.enableBoundingBoxRendering before resetting the current list of bounding boxes, because:\r\n // * if bounding box rendering is enabled, we want to start with an empty list and add new bounding boxes to it\r\n // * if bounding box rendering is disabled, we don't want to render any bounding boxes that may have been generated by previous code\r\n boundingBoxRenderer && boundingBoxRenderer.reset();\r\n\r\n if (this.renderMeshes) {\r\n const sceneRenderId = scene.getRenderId();\r\n const currentFrameId = scene.getFrameId();\r\n for (let meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {\r\n const mesh = currentRenderList[meshIndex];\r\n\r\n if (mesh && !mesh.isBlocked) {\r\n if (this.customIsReadyFunction) {\r\n if (!this.customIsReadyFunction(mesh, this.refreshRate, false)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n } else if (!mesh.isReady(this.refreshRate === 0)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n\r\n let meshToRender: Nullable<AbstractMesh>;\r\n\r\n if (cameraForLOD) {\r\n const meshToRenderAndFrameId = mesh._internalAbstractMeshDataInfo._currentLOD.get(cameraForLOD);\r\n if (!meshToRenderAndFrameId || meshToRenderAndFrameId[1] !== currentFrameId) {\r\n meshToRender = scene.customLODSelector ? scene.customLODSelector(mesh, cameraForLOD) : mesh.getLOD(cameraForLOD);\r\n if (!meshToRenderAndFrameId) {\r\n mesh._internalAbstractMeshDataInfo._currentLOD.set(cameraForLOD, [meshToRender, currentFrameId]);\r\n } else {\r\n meshToRenderAndFrameId[0] = meshToRender;\r\n meshToRenderAndFrameId[1] = currentFrameId;\r\n }\r\n } else {\r\n meshToRender = meshToRenderAndFrameId[0];\r\n }\r\n } else {\r\n meshToRender = mesh;\r\n }\r\n\r\n if (!meshToRender) {\r\n continue;\r\n }\r\n\r\n if (meshToRender !== mesh && meshToRender.billboardMode !== 0) {\r\n meshToRender.computeWorldMatrix(); // Compute world matrix if LOD is billboard\r\n }\r\n\r\n meshToRender._preActivateForIntermediateRendering(sceneRenderId);\r\n\r\n let isMasked;\r\n if (checkLayerMask && camera) {\r\n isMasked = (mesh.layerMask & camera.layerMask) === 0;\r\n } else {\r\n isMasked = false;\r\n }\r\n\r\n if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {\r\n this._activeMeshes.push(mesh);\r\n meshToRender._internalAbstractMeshDataInfo._wasActiveLastFrame = true;\r\n\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(sceneRenderId, true);\r\n }\r\n\r\n this.enableBoundingBoxRendering && boundingBoxRenderer && boundingBoxRenderer._preActiveMesh(mesh);\r\n\r\n if (mesh._activate(sceneRenderId, true) && mesh.subMeshes.length) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;\r\n } else {\r\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\r\n meshToRender = mesh;\r\n }\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActiveIntermediate = true;\r\n\r\n scene._prepareSkeleton(meshToRender);\r\n\r\n for (let subIndex = 0; subIndex < meshToRender.subMeshes.length; subIndex++) {\r\n const subMesh = meshToRender.subMeshes[subIndex];\r\n this.enableBoundingBoxRendering && boundingBoxRenderer && boundingBoxRenderer._evaluateSubMesh(mesh, subMesh);\r\n this._renderingManager.dispatch(subMesh, meshToRender);\r\n }\r\n }\r\n\r\n mesh._postActivate();\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (this.enableBoundingBoxRendering && boundingBoxRenderer && winterIsComing) {\r\n for (let i = 0; i < boundingBoxRenderer.renderList.length; i++) {\r\n const boundingBox = boundingBoxRenderer.renderList.data[i];\r\n this._activeBoundingBoxes.push(boundingBox);\r\n }\r\n }\r\n\r\n if (this._scene.particlesEnabled && this.renderParticles) {\r\n this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);\r\n const particleSystems = this.particleSystemList || scene.particleSystems;\r\n for (let particleIndex = 0; particleIndex < particleSystems.length; particleIndex++) {\r\n const particleSystem = particleSystems[particleIndex];\r\n\r\n const emitter: any = particleSystem.emitter;\r\n\r\n if (!particleSystem.isStarted() || !emitter || (emitter.position && !emitter.isEnabled())) {\r\n continue;\r\n }\r\n\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene);\r\n }\r\n\r\n return currentRenderList;\r\n }\r\n\r\n /**\r\n * Gets the rendering manager\r\n */\r\n public get renderingManager(): RenderingManager {\r\n return this._renderingManager;\r\n }\r\n\r\n /**\r\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversely depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n public setRenderingOrder(\r\n renderingGroupId: number,\r\n opaqueSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n alphaTestSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n transparentSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null\r\n ): void {\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n }\r\n\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n public setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth = true, stencil = true): void {\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\r\n this._renderingManager._useSceneAutoClearSetup = false;\r\n }\r\n\r\n /**\r\n * Clones the renderer.\r\n * @returns the cloned renderer\r\n */\r\n public clone(): ObjectRenderer {\r\n const newRenderer = new ObjectRenderer(this.name, this._scene, this.options);\r\n\r\n if (this.renderList) {\r\n newRenderer.renderList = this.renderList.slice(0);\r\n }\r\n\r\n return newRenderer;\r\n }\r\n\r\n /**\r\n * Dispose the renderer and release its associated resources.\r\n */\r\n public dispose(): void {\r\n const renderList = this.renderList ? this.renderList : this._scene.getActiveMeshes().data;\r\n const renderListLength = this.renderList ? this.renderList.length : this._scene.getActiveMeshes().length;\r\n for (let i = 0; i < renderListLength; i++) {\r\n const mesh = renderList[i];\r\n if (mesh && mesh.getMaterialForRenderPass(this.renderPassId) !== undefined) {\r\n mesh.setMaterialForRenderPass(this.renderPassId, undefined);\r\n }\r\n }\r\n\r\n this.onInitRenderingObservable.clear();\r\n this.onFinishRenderingObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderingManagerRenderObservable.clear();\r\n this.onAfterRenderingManagerRenderObservable.clear();\r\n this.onFastPathRenderObservable.clear();\r\n\r\n this._releaseRenderPassId();\r\n\r\n this.renderList = null;\r\n if (this._sceneUBOs) {\r\n for (const ubo of this._sceneUBOs) {\r\n ubo.dispose();\r\n }\r\n }\r\n this._sceneUBOs = undefined as any;\r\n\r\n this._scene.removeObjectRenderer(this);\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this.refreshRate === ObjectRenderer.REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = ObjectRenderer.REFRESHRATE_RENDER_ONCE;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the info related to rendering groups preventing retention point in material dispose.\r\n */\r\n public freeRenderingGroups(): void {\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -29,28 +29,59 @@ uint partIndex;
|
|
|
29
29
|
#if defined(IS_FOR_VOXELIZATION)
|
|
30
30
|
vec4 rotationA;vec4 rotationB;vec4 rotationScale;
|
|
31
31
|
#endif
|
|
32
|
+
#ifdef USE_SOG
|
|
33
|
+
float splatIndex;
|
|
34
|
+
#endif
|
|
32
35
|
};float getSplatIndex(int localIndex)
|
|
33
36
|
{float splatIndex;switch (localIndex)
|
|
34
37
|
{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}
|
|
35
38
|
return splatIndex;}
|
|
36
39
|
Splat readSplat(float splatIndex)
|
|
37
|
-
{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);
|
|
40
|
+
{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);
|
|
41
|
+
#ifdef USE_SOG
|
|
42
|
+
ivec2 sogUVi=ivec2(int(splatUV.x*dataTextureSize.x),int(splatUV.y*dataTextureSize.y));vec4 mL=texelFetch(centersTexture,sogUVi,0);
|
|
43
|
+
vec4 mU=texelFetch(covariancesATexture,sogUVi,0);
|
|
44
|
+
vec4 sRaw=texelFetch(covariancesBTexture,sogUVi,0);
|
|
45
|
+
vec4 qRaw=texelFetch(sogQuatsTexture,sogUVi,0);
|
|
46
|
+
vec4 c0=texelFetch(colorsTexture,sogUVi,0);
|
|
47
|
+
vec3 q16=(mU.xyz*256.0+mL.xyz)*(255.0/65535.0);vec3 nPos=mix(sogMeansMin,sogMeansMax,q16);vec3 center=sign(nPos)*(exp(abs(nPos))-vec3(1.0));splat.center=vec4(center,1.0);
|
|
48
|
+
#ifdef USE_SOG_V2
|
|
49
|
+
vec3 sIdx=floor(sRaw.xyz*255.0+0.5);vec3 splatScale;splatScale.x=exp(texelFetch(sogCodebookTexture,ivec2(int(sIdx.x),0),0).r);splatScale.y=exp(texelFetch(sogCodebookTexture,ivec2(int(sIdx.y),0),0).r);splatScale.z=exp(texelFetch(sogCodebookTexture,ivec2(int(sIdx.z),0),0).r);
|
|
50
|
+
#else
|
|
51
|
+
vec3 splatScale=exp(mix(sogScalesMin,sogScalesMax,sRaw.xyz));
|
|
52
|
+
#endif
|
|
53
|
+
const float invSqrt2=0.70710678118;vec3 qabc=(qRaw.xyz-vec3(0.5))*2.0*invSqrt2;int qMode=int(qRaw.w*255.0+0.5)-252;float qd=sqrt(max(0.0,1.0-dot(qabc,qabc)));vec4 quat;if (qMode==0) quat=vec4(qd,qabc.x,qabc.y,qabc.z);else if (qMode==1) quat=vec4(qabc.x,qd,qabc.y,qabc.z);else if (qMode==2) quat=vec4(qabc.x,qabc.y,qd,qabc.z);else quat=vec4(qabc.x,qabc.y,qabc.z,qd);float qw=quat.x,qx=quat.y,qy=quat.z,qz=quat.w;mat3 R=mat3(
|
|
54
|
+
1.0-2.0*(qy*qy+qz*qz),2.0*(qx*qy+qw*qz), 2.0*(qx*qz-qw*qy),
|
|
55
|
+
2.0*(qx*qy-qw*qz), 1.0-2.0*(qx*qx+qz*qz),2.0*(qy*qz+qw*qx),
|
|
56
|
+
2.0*(qx*qz+qw*qy), 2.0*(qy*qz-qw*qx), 1.0-2.0*(qx*qx+qy*qy)
|
|
57
|
+
);mat3 S2=mat3(4.0*splatScale.x*splatScale.x,0.0,0.0,
|
|
58
|
+
0.0,4.0*splatScale.y*splatScale.y,0.0,
|
|
59
|
+
0.0,0.0,4.0*splatScale.z*splatScale.z);mat3 Sigma=R*S2*transpose(R);splat.covA=vec4(Sigma[0][0],Sigma[0][1],Sigma[0][2],Sigma[1][1]);splat.covB=vec4(Sigma[1][2],Sigma[2][2],0.0,0.0);const float SH_C0=0.28209479177387814;
|
|
60
|
+
#ifdef USE_SOG_V2
|
|
61
|
+
vec3 c3;c3.x=texelFetch(sogCodebookTexture,ivec2(256+int(c0.x*255.0+0.5),0),0).r;c3.y=texelFetch(sogCodebookTexture,ivec2(256+int(c0.y*255.0+0.5),0),0).r;c3.z=texelFetch(sogCodebookTexture,ivec2(256+int(c0.z*255.0+0.5),0),0).r;vec3 colRgb=vec3(0.5)+c3*SH_C0;float colA=c0.w;
|
|
62
|
+
#else
|
|
63
|
+
vec4 cLerp=mix(sogSh0Min,sogSh0Max,c0);vec3 colRgb=vec3(0.5)+cLerp.xyz*SH_C0;float colA=1.0/(1.0+exp(-cLerp.w));
|
|
64
|
+
#endif
|
|
65
|
+
splat.color=vec4(colRgb,colA);splat.splatIndex=splatIndex;
|
|
66
|
+
#else
|
|
67
|
+
splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);
|
|
38
68
|
#if !defined(IS_FOR_VOXELIZATION)
|
|
39
69
|
splat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;
|
|
40
70
|
#endif
|
|
71
|
+
#endif
|
|
41
72
|
#if SH_DEGREE>0 || IS_COMPOUND
|
|
42
73
|
ivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);
|
|
43
74
|
#endif
|
|
44
|
-
#if SH_DEGREE>0
|
|
75
|
+
#if SH_DEGREE>0 && !defined(USE_SOG)
|
|
45
76
|
splat.sh0=texelFetch(shTexture0,splatUVint,0);
|
|
46
77
|
#endif
|
|
47
|
-
#if SH_DEGREE>1
|
|
78
|
+
#if SH_DEGREE>1 && !defined(USE_SOG)
|
|
48
79
|
splat.sh1=texelFetch(shTexture1,splatUVint,0);
|
|
49
80
|
#endif
|
|
50
|
-
#if SH_DEGREE>2
|
|
81
|
+
#if SH_DEGREE>2 && !defined(USE_SOG)
|
|
51
82
|
splat.sh2=texelFetch(shTexture2,splatUVint,0);
|
|
52
83
|
#endif
|
|
53
|
-
#if SH_DEGREE>3
|
|
84
|
+
#if SH_DEGREE>3 && !defined(USE_SOG)
|
|
54
85
|
splat.sh3=texelFetch(shTexture3,splatUVint,0);splat.sh4=texelFetch(shTexture4,splatUVint,0);
|
|
55
86
|
#endif
|
|
56
87
|
#if IS_COMPOUND
|
|
@@ -103,6 +134,23 @@ float((value ) & 255u),
|
|
|
103
134
|
float((value>>uint( 8)) & 255u),
|
|
104
135
|
float((value>>uint(16)) & 255u),
|
|
105
136
|
float((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}
|
|
137
|
+
#ifdef USE_SOG
|
|
138
|
+
vec3 computeSH(Splat splat,vec3 dir)
|
|
139
|
+
{
|
|
140
|
+
#if SH_DEGREE>0
|
|
141
|
+
vec3 sh[25];sh[0]=vec3(0.,0.,0.);ivec2 labelSize=textureSize(sogShNLabelsTexture,0);int idx=int(splat.splatIndex+0.5);int lx=idx-(idx/labelSize.x)*labelSize.x;int ly=idx/labelSize.x;vec4 labelRaw=texelFetch(sogShNLabelsTexture,ivec2(lx,ly),0);int n=int(labelRaw.r*255.0+0.5)+int(labelRaw.g*255.0+0.5)*256;int coeffs=int(sogShCoeffCount+0.5);int u=(n-(n/64)*64)*coeffs;int v=n/64;for (int k=0; k<24; k++) {if (k>=coeffs) break;vec4 centroidRaw=texelFetch(sogShNCentroidsTexture,ivec2(u+k,v),0);vec3 shCoeff;
|
|
142
|
+
#ifdef USE_SOG_V2
|
|
143
|
+
int rIdx=int(centroidRaw.r*255.0+0.5);int gIdx=int(centroidRaw.g*255.0+0.5);int bIdx=int(centroidRaw.b*255.0+0.5);shCoeff.r=texelFetch(sogCodebookTexture,ivec2(512+rIdx,0),0).r;shCoeff.g=texelFetch(sogCodebookTexture,ivec2(512+gIdx,0),0).r;shCoeff.b=texelFetch(sogCodebookTexture,ivec2(512+bIdx,0),0).r;
|
|
144
|
+
#else
|
|
145
|
+
shCoeff=mix(vec3(sogShnMin),vec3(sogShnMax),centroidRaw.rgb);
|
|
146
|
+
#endif
|
|
147
|
+
sh[k+1]=shCoeff;}
|
|
148
|
+
return computeColorFromSHDegree(dir,sh,1.,1.,1.,1.);
|
|
149
|
+
#else
|
|
150
|
+
return vec3(0.,0.,0.);
|
|
151
|
+
#endif
|
|
152
|
+
}
|
|
153
|
+
#else
|
|
106
154
|
vec3 computeSHWeighted(Splat splat,vec3 dir,float _so1,float _so2,float _so3,float _so4)
|
|
107
155
|
{vec3 sh[25];sh[0]=vec3(0.,0.,0.);
|
|
108
156
|
#if SH_DEGREE>0
|
|
@@ -141,6 +189,7 @@ float _w4=1.0;
|
|
|
141
189
|
float _w4=0.0;
|
|
142
190
|
#endif
|
|
143
191
|
return computeSHWeighted(splat,dir,_w1,_w2,_w3,_w4);}
|
|
192
|
+
#endif
|
|
144
193
|
#else
|
|
145
194
|
vec3 computeSH(Splat splat,vec3 dir)
|
|
146
195
|
{return vec3(0.,0.,0.);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ld,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"gaussianSplatting\";\nconst shader = `#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE)\nmat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0],\nmatrix[0][1],matrix[1][1],matrix[2][1],\nmatrix[0][2],matrix[1][2],matrix[2][2]);}\n#endif\nvec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}\n#endif\nstruct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB;\n#if SH_DEGREE>0\nuvec4 sh0; \n#endif\n#if SH_DEGREE>1\nuvec4 sh1;\n#endif\n#if SH_DEGREE>2\nuvec4 sh2;\n#endif\n#if SH_DEGREE>3\nuvec4 sh3;uvec4 sh4;\n#endif\n#if IS_COMPOUND\nuint partIndex;\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 rotationA;vec4 rotationB;vec4 rotationScale;\n#endif\n};float getSplatIndex(int localIndex)\n{float splatIndex;switch (localIndex)\n{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}\nreturn splatIndex;}\nSplat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);\n#if !defined(IS_FOR_VOXELIZATION)\nsplat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#endif\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);\n#endif\n#if SH_DEGREE>0\nsplat.sh0=texelFetch(shTexture0,splatUVint,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=texelFetch(shTexture1,splatUVint,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=texelFetch(shTexture2,splatUVint,0);\n#endif\n#if SH_DEGREE>3\nsplat.sh3=texelFetch(shTexture3,splatUVint,0);splat.sh4=texelFetch(shTexture4,splatUVint,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=uint(texture2D(partIndicesTexture,splatUV).r*255.0+0.5);\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nsplat.rotationA=texture2D(rotationsATexture,splatUV);splat.rotationB=texture2D(rotationsBTexture,splatUV);splat.rotationScale=texture2D(rotationScaleTexture,splatUV);\n#endif\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[25],float _so1,float _so2,float _so3,float _so4)\n{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;float SH_C4[9];SH_C4[0]= 2.5033429418;SH_C4[1]=-1.7701307698;SH_C4[2]= 0.9461746958;SH_C4[3]=-0.6690465436;SH_C4[4]= 0.1057855469;SH_C4[5]=-0.6690465436;SH_C4[6]= 0.4730873479;SH_C4[7]=-1.7701307698;SH_C4[8]= 0.6258357354;vec3 result=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nfloat x=dir.x;float y=dir.y;float z=dir.z;result+=_so1*(- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]);\n#if SH_DEGREE>1\nfloat xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=_so2*(\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8]);\n#if SH_DEGREE>2\nresult+=_so3*(\nSH_C3[0]*y*(3.0*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +\nSH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0*yy)*sh[15]);\n#if SH_DEGREE>3\nresult+=_so4*(\nSH_C4[0]*x*y*(xx-yy)*sh[16] +\nSH_C4[1]*y*z*(3.0*xx-yy)*sh[17] +\nSH_C4[2]*x*y*(7.0*zz-1.0)*sh[18] +\nSH_C4[3]*y*z*(7.0*zz-3.0)*sh[19] +\nSH_C4[4]*(zz*(35.0*zz-30.0)+3.0)*sh[20] +\nSH_C4[5]*x*z*(7.0*zz-3.0)*sh[21] +\nSH_C4[6]*(xx-yy)*(7.0*zz-1.0)*sh[22] +\nSH_C4[7]*x*z*(xx-3.0*yy)*sh[23] +\nSH_C4[8]*(xx*(xx-3.0*yy)-yy*(3.0*xx-yy))*sh[24]);\n#endif\n#endif\n#endif\n#endif\nreturn result;}\nvec4 decompose(uint value)\n{vec4 components=vec4(\nfloat((value ) & 255u),\nfloat((value>>uint( 8)) & 255u),\nfloat((value>>uint(16)) & 255u),\nfloat((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}\nvec3 computeSHWeighted(Splat splat,vec3 dir,float _so1,float _so2,float _so3,float _so4)\n{vec3 sh[25];sh[0]=vec3(0.,0.,0.);\n#if SH_DEGREE>0\nvec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nvec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nvec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x);\n#endif\n#if SH_DEGREE>3\nvec4 sh12=decompose(splat.sh3.x);vec4 sh13=decompose(splat.sh3.y);vec4 sh14=decompose(splat.sh3.z);vec4 sh15=decompose(splat.sh3.w);vec4 sh16=decompose(splat.sh4.x);vec4 sh17=decompose(splat.sh4.y);sh[16]=vec3(sh11.y,sh11.z,sh11.w);sh[17]=vec3(sh12.x,sh12.y,sh12.z);sh[18]=vec3(sh12.w,sh13.x,sh13.y);sh[19]=vec3(sh13.z,sh13.w,sh14.x);sh[20]=vec3(sh14.y,sh14.z,sh14.w);sh[21]=vec3(sh15.x,sh15.y,sh15.z);sh[22]=vec3(sh15.w,sh16.x,sh16.y);sh[23]=vec3(sh16.z,sh16.w,sh17.x);sh[24]=vec3(sh17.y,sh17.z,sh17.w);\n#endif\nreturn computeColorFromSHDegree(dir,sh,_so1,_so2,_so3,_so4);}\nvec3 computeSH(Splat splat,vec3 dir)\n{\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER1==1\nfloat _w1=1.0;\n#else\nfloat _w1=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER2==1\nfloat _w2=1.0;\n#else\nfloat _w2=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER3==1\nfloat _w3=1.0;\n#else\nfloat _w3=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER4==1\nfloat _w4=1.0;\n#else\nfloat _w4=0.0;\n#endif\nreturn computeSHWeighted(splat,dir,_w1,_w2,_w3,_w4);}\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\n#if !defined(IS_FOR_VOXELIZATION)\nvec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)\n{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds\n|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);}\nmat3 Vrk=mat3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3(\nfocal.x,0.,0.,\n0.,focal.y,0.,\n0.,0.,0.\n);} else {J=mat3(\nfocal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.,0.,0.\n);}\nmat3 T=transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nfloat c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nvec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation;\n#endif\nfloat mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0)\n{return vec4(0.0,0.0,2.0,1.0);}\nvec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}\n#endif\n#if IS_COMPOUND\nmat4 getPartWorld(uint partIndex) {return partWorld[partIndex];}\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 computeVoxelSplatWorldPos(vec4 rotationA,vec4 rotationB,vec4 rotationScale,vec3 center,mat4 splatWorld,mat4 viewMatrix,mat4 invWorldScale,vec2 quadPos) {mat3 splatRotation=mat3(\nvec3(rotationA.x,rotationA.y,rotationA.z),\nvec3(rotationA.w,rotationB.x,rotationB.y),\nvec3(rotationB.z,rotationB.w,rotationScale.x)\n);vec3 splatScale=vec3(rotationScale.y,rotationScale.z,rotationScale.w);mat3 rotToView=mat3(viewMatrix)*mat3(invWorldScale)*mat3(splatWorld)*splatRotation;vec3 axisLengthInViewZ=abs(vec3(rotToView[0][2],rotToView[1][2],rotToView[2][2]));float gaussianSplatCutoffStddev=1.4142135624/2.0; \nvec3 offsetSplatSpace;if (axisLengthInViewZ.x>axisLengthInViewZ.y && axisLengthInViewZ.x>axisLengthInViewZ.z) {offsetSplatSpace=vec3(0.0,quadPos.x,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else if (axisLengthInViewZ.y>axisLengthInViewZ.z) {offsetSplatSpace=vec3(quadPos.x,0.0,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else {offsetSplatSpace=vec3(quadPos.x,quadPos.y,0.0)*splatScale*gaussianSplatCutoffStddev;}\nvec3 vertexObjectSpace=center+splatRotation*offsetSplatSpace;return splatWorld*vec4(vertexObjectSpace,1.0);}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplatting = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Od,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"gaussianSplatting\";\nconst shader = `#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE)\nmat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0],\nmatrix[0][1],matrix[1][1],matrix[2][1],\nmatrix[0][2],matrix[1][2],matrix[2][2]);}\n#endif\nvec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}\n#endif\nstruct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB;\n#if SH_DEGREE>0\nuvec4 sh0; \n#endif\n#if SH_DEGREE>1\nuvec4 sh1;\n#endif\n#if SH_DEGREE>2\nuvec4 sh2;\n#endif\n#if SH_DEGREE>3\nuvec4 sh3;uvec4 sh4;\n#endif\n#if IS_COMPOUND\nuint partIndex;\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 rotationA;vec4 rotationB;vec4 rotationScale;\n#endif\n#ifdef USE_SOG\nfloat splatIndex;\n#endif\n};float getSplatIndex(int localIndex)\n{float splatIndex;switch (localIndex)\n{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}\nreturn splatIndex;}\nSplat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);\n#ifdef USE_SOG\nivec2 sogUVi=ivec2(int(splatUV.x*dataTextureSize.x),int(splatUV.y*dataTextureSize.y));vec4 mL=texelFetch(centersTexture,sogUVi,0); \nvec4 mU=texelFetch(covariancesATexture,sogUVi,0); \nvec4 sRaw=texelFetch(covariancesBTexture,sogUVi,0); \nvec4 qRaw=texelFetch(sogQuatsTexture,sogUVi,0); \nvec4 c0=texelFetch(colorsTexture,sogUVi,0); \nvec3 q16=(mU.xyz*256.0+mL.xyz)*(255.0/65535.0);vec3 nPos=mix(sogMeansMin,sogMeansMax,q16);vec3 center=sign(nPos)*(exp(abs(nPos))-vec3(1.0));splat.center=vec4(center,1.0);\n#ifdef USE_SOG_V2\nvec3 sIdx=floor(sRaw.xyz*255.0+0.5);vec3 splatScale;splatScale.x=exp(texelFetch(sogCodebookTexture,ivec2(int(sIdx.x),0),0).r);splatScale.y=exp(texelFetch(sogCodebookTexture,ivec2(int(sIdx.y),0),0).r);splatScale.z=exp(texelFetch(sogCodebookTexture,ivec2(int(sIdx.z),0),0).r);\n#else\nvec3 splatScale=exp(mix(sogScalesMin,sogScalesMax,sRaw.xyz));\n#endif\nconst float invSqrt2=0.70710678118;vec3 qabc=(qRaw.xyz-vec3(0.5))*2.0*invSqrt2;int qMode=int(qRaw.w*255.0+0.5)-252;float qd=sqrt(max(0.0,1.0-dot(qabc,qabc)));vec4 quat;if (qMode==0) quat=vec4(qd,qabc.x,qabc.y,qabc.z);else if (qMode==1) quat=vec4(qabc.x,qd,qabc.y,qabc.z);else if (qMode==2) quat=vec4(qabc.x,qabc.y,qd,qabc.z);else quat=vec4(qabc.x,qabc.y,qabc.z,qd);float qw=quat.x,qx=quat.y,qy=quat.z,qz=quat.w;mat3 R=mat3(\n1.0-2.0*(qy*qy+qz*qz),2.0*(qx*qy+qw*qz), 2.0*(qx*qz-qw*qy),\n2.0*(qx*qy-qw*qz), 1.0-2.0*(qx*qx+qz*qz),2.0*(qy*qz+qw*qx),\n2.0*(qx*qz+qw*qy), 2.0*(qy*qz-qw*qx), 1.0-2.0*(qx*qx+qy*qy)\n);mat3 S2=mat3(4.0*splatScale.x*splatScale.x,0.0,0.0,\n0.0,4.0*splatScale.y*splatScale.y,0.0,\n0.0,0.0,4.0*splatScale.z*splatScale.z);mat3 Sigma=R*S2*transpose(R);splat.covA=vec4(Sigma[0][0],Sigma[0][1],Sigma[0][2],Sigma[1][1]);splat.covB=vec4(Sigma[1][2],Sigma[2][2],0.0,0.0);const float SH_C0=0.28209479177387814;\n#ifdef USE_SOG_V2\nvec3 c3;c3.x=texelFetch(sogCodebookTexture,ivec2(256+int(c0.x*255.0+0.5),0),0).r;c3.y=texelFetch(sogCodebookTexture,ivec2(256+int(c0.y*255.0+0.5),0),0).r;c3.z=texelFetch(sogCodebookTexture,ivec2(256+int(c0.z*255.0+0.5),0),0).r;vec3 colRgb=vec3(0.5)+c3*SH_C0;float colA=c0.w; \n#else\nvec4 cLerp=mix(sogSh0Min,sogSh0Max,c0);vec3 colRgb=vec3(0.5)+cLerp.xyz*SH_C0;float colA=1.0/(1.0+exp(-cLerp.w));\n#endif\nsplat.color=vec4(colRgb,colA);splat.splatIndex=splatIndex;\n#else\nsplat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);\n#if !defined(IS_FOR_VOXELIZATION)\nsplat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#endif\n#endif\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);\n#endif\n#if SH_DEGREE>0 && !defined(USE_SOG)\nsplat.sh0=texelFetch(shTexture0,splatUVint,0);\n#endif\n#if SH_DEGREE>1 && !defined(USE_SOG)\nsplat.sh1=texelFetch(shTexture1,splatUVint,0);\n#endif\n#if SH_DEGREE>2 && !defined(USE_SOG)\nsplat.sh2=texelFetch(shTexture2,splatUVint,0);\n#endif\n#if SH_DEGREE>3 && !defined(USE_SOG)\nsplat.sh3=texelFetch(shTexture3,splatUVint,0);splat.sh4=texelFetch(shTexture4,splatUVint,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=uint(texture2D(partIndicesTexture,splatUV).r*255.0+0.5);\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nsplat.rotationA=texture2D(rotationsATexture,splatUV);splat.rotationB=texture2D(rotationsBTexture,splatUV);splat.rotationScale=texture2D(rotationScaleTexture,splatUV);\n#endif\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[25],float _so1,float _so2,float _so3,float _so4)\n{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;float SH_C4[9];SH_C4[0]= 2.5033429418;SH_C4[1]=-1.7701307698;SH_C4[2]= 0.9461746958;SH_C4[3]=-0.6690465436;SH_C4[4]= 0.1057855469;SH_C4[5]=-0.6690465436;SH_C4[6]= 0.4730873479;SH_C4[7]=-1.7701307698;SH_C4[8]= 0.6258357354;vec3 result=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nfloat x=dir.x;float y=dir.y;float z=dir.z;result+=_so1*(- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]);\n#if SH_DEGREE>1\nfloat xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=_so2*(\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8]);\n#if SH_DEGREE>2\nresult+=_so3*(\nSH_C3[0]*y*(3.0*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +\nSH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0*yy)*sh[15]);\n#if SH_DEGREE>3\nresult+=_so4*(\nSH_C4[0]*x*y*(xx-yy)*sh[16] +\nSH_C4[1]*y*z*(3.0*xx-yy)*sh[17] +\nSH_C4[2]*x*y*(7.0*zz-1.0)*sh[18] +\nSH_C4[3]*y*z*(7.0*zz-3.0)*sh[19] +\nSH_C4[4]*(zz*(35.0*zz-30.0)+3.0)*sh[20] +\nSH_C4[5]*x*z*(7.0*zz-3.0)*sh[21] +\nSH_C4[6]*(xx-yy)*(7.0*zz-1.0)*sh[22] +\nSH_C4[7]*x*z*(xx-3.0*yy)*sh[23] +\nSH_C4[8]*(xx*(xx-3.0*yy)-yy*(3.0*xx-yy))*sh[24]);\n#endif\n#endif\n#endif\n#endif\nreturn result;}\nvec4 decompose(uint value)\n{vec4 components=vec4(\nfloat((value ) & 255u),\nfloat((value>>uint( 8)) & 255u),\nfloat((value>>uint(16)) & 255u),\nfloat((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}\n#ifdef USE_SOG\nvec3 computeSH(Splat splat,vec3 dir)\n{\n#if SH_DEGREE>0\nvec3 sh[25];sh[0]=vec3(0.,0.,0.);ivec2 labelSize=textureSize(sogShNLabelsTexture,0);int idx=int(splat.splatIndex+0.5);int lx=idx-(idx/labelSize.x)*labelSize.x;int ly=idx/labelSize.x;vec4 labelRaw=texelFetch(sogShNLabelsTexture,ivec2(lx,ly),0);int n=int(labelRaw.r*255.0+0.5)+int(labelRaw.g*255.0+0.5)*256;int coeffs=int(sogShCoeffCount+0.5);int u=(n-(n/64)*64)*coeffs;int v=n/64;for (int k=0; k<24; k++) {if (k>=coeffs) break;vec4 centroidRaw=texelFetch(sogShNCentroidsTexture,ivec2(u+k,v),0);vec3 shCoeff;\n#ifdef USE_SOG_V2\nint rIdx=int(centroidRaw.r*255.0+0.5);int gIdx=int(centroidRaw.g*255.0+0.5);int bIdx=int(centroidRaw.b*255.0+0.5);shCoeff.r=texelFetch(sogCodebookTexture,ivec2(512+rIdx,0),0).r;shCoeff.g=texelFetch(sogCodebookTexture,ivec2(512+gIdx,0),0).r;shCoeff.b=texelFetch(sogCodebookTexture,ivec2(512+bIdx,0),0).r;\n#else\nshCoeff=mix(vec3(sogShnMin),vec3(sogShnMax),centroidRaw.rgb);\n#endif\nsh[k+1]=shCoeff;}\nreturn computeColorFromSHDegree(dir,sh,1.,1.,1.,1.);\n#else\nreturn vec3(0.,0.,0.);\n#endif\n}\n#else\nvec3 computeSHWeighted(Splat splat,vec3 dir,float _so1,float _so2,float _so3,float _so4)\n{vec3 sh[25];sh[0]=vec3(0.,0.,0.);\n#if SH_DEGREE>0\nvec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nvec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nvec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x);\n#endif\n#if SH_DEGREE>3\nvec4 sh12=decompose(splat.sh3.x);vec4 sh13=decompose(splat.sh3.y);vec4 sh14=decompose(splat.sh3.z);vec4 sh15=decompose(splat.sh3.w);vec4 sh16=decompose(splat.sh4.x);vec4 sh17=decompose(splat.sh4.y);sh[16]=vec3(sh11.y,sh11.z,sh11.w);sh[17]=vec3(sh12.x,sh12.y,sh12.z);sh[18]=vec3(sh12.w,sh13.x,sh13.y);sh[19]=vec3(sh13.z,sh13.w,sh14.x);sh[20]=vec3(sh14.y,sh14.z,sh14.w);sh[21]=vec3(sh15.x,sh15.y,sh15.z);sh[22]=vec3(sh15.w,sh16.x,sh16.y);sh[23]=vec3(sh16.z,sh16.w,sh17.x);sh[24]=vec3(sh17.y,sh17.z,sh17.w);\n#endif\nreturn computeColorFromSHDegree(dir,sh,_so1,_so2,_so3,_so4);}\nvec3 computeSH(Splat splat,vec3 dir)\n{\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER1==1\nfloat _w1=1.0;\n#else\nfloat _w1=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER2==1\nfloat _w2=1.0;\n#else\nfloat _w2=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER3==1\nfloat _w3=1.0;\n#else\nfloat _w3=0.0;\n#endif\n#if !defined(GS_DBG_ENABLED) || GS_DBG_SH_ORDER4==1\nfloat _w4=1.0;\n#else\nfloat _w4=0.0;\n#endif\nreturn computeSHWeighted(splat,dir,_w1,_w2,_w3,_w4);}\n#endif\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\n#if !defined(IS_FOR_VOXELIZATION)\nvec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)\n{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds\n|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);}\nmat3 Vrk=mat3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3(\nfocal.x,0.,0.,\n0.,focal.y,0.,\n0.,0.,0.\n);} else {J=mat3(\nfocal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.,0.,0.\n);}\nmat3 T=transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nfloat c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nvec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation;\n#endif\nfloat mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0)\n{return vec4(0.0,0.0,2.0,1.0);}\nvec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}\n#endif\n#if IS_COMPOUND\nmat4 getPartWorld(uint partIndex) {return partWorld[partIndex];}\n#endif\n#if defined(IS_FOR_VOXELIZATION)\nvec4 computeVoxelSplatWorldPos(vec4 rotationA,vec4 rotationB,vec4 rotationScale,vec3 center,mat4 splatWorld,mat4 viewMatrix,mat4 invWorldScale,vec2 quadPos) {mat3 splatRotation=mat3(\nvec3(rotationA.x,rotationA.y,rotationA.z),\nvec3(rotationA.w,rotationB.x,rotationB.y),\nvec3(rotationB.z,rotationB.w,rotationScale.x)\n);vec3 splatScale=vec3(rotationScale.y,rotationScale.z,rotationScale.w);mat3 rotToView=mat3(viewMatrix)*mat3(invWorldScale)*mat3(splatWorld)*splatRotation;vec3 axisLengthInViewZ=abs(vec3(rotToView[0][2],rotToView[1][2],rotToView[2][2]));float gaussianSplatCutoffStddev=1.4142135624/2.0; \nvec3 offsetSplatSpace;if (axisLengthInViewZ.x>axisLengthInViewZ.y && axisLengthInViewZ.x>axisLengthInViewZ.z) {offsetSplatSpace=vec3(0.0,quadPos.x,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else if (axisLengthInViewZ.y>axisLengthInViewZ.z) {offsetSplatSpace=vec3(quadPos.x,0.0,quadPos.y)*splatScale*gaussianSplatCutoffStddev;} else {offsetSplatSpace=vec3(quadPos.x,quadPos.y,0.0)*splatScale*gaussianSplatCutoffStddev;}\nvec3 vertexObjectSpace=center+splatRotation*offsetSplatSpace;return splatWorld*vec4(vertexObjectSpace,1.0);}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplatting = { name, shader };\n"]}
|
|
@@ -39,7 +39,7 @@ finalIrradiance*=clearcoatOut.absorption;
|
|
|
39
39
|
#ifndef SS_APPLY_ALBEDO_AFTER_SUBSURFACE
|
|
40
40
|
finalIrradiance*=surfaceAlbedo.rgb;
|
|
41
41
|
#endif
|
|
42
|
-
#if defined(SS_REFRACTION)
|
|
42
|
+
#if defined(SS_REFRACTION) && !defined(LEGACY_SPECULAR_ENERGY_CONSERVATION)
|
|
43
43
|
finalIrradiance*=subSurfaceOut.refractionOpacity;
|
|
44
44
|
#endif
|
|
45
45
|
#if defined(SS_TRANSLUCENCY)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbrBlockFinalLitComponents.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrBlockFinalLitComponents.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAC1C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Gd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"pbrBlockFinalLitComponents\";\nconst shader = `aggShadow=aggShadow/numLights;\n#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 baseSpecularEnergyConservationFactor=getEnergyConservationFactor(vec3(reflectanceF0),environmentBrdf);vec3 coloredEnergyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\n#endif\n#endif\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\n#endif\n#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION\n#ifndef METALLICWORKFLOW\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\nsurfaceAlbedo.rgb=(1.-reflectanceF0)*surfaceAlbedo.rgb;\n#endif\n#endif\n#endif\n#ifdef REFLECTION\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\n#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION\n#if defined(METALLICWORKFLOW) || defined(SPECULAR_GLOSSINESS_ENERGY_CONSERVATION)\nvec3 baseSpecularEnergy=vec3(baseSpecularEnvironmentReflectance);\n#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nbaseSpecularEnergy*=baseSpecularEnergyConservationFactor;\n#endif\n#endif\nfinalIrradiance*=clamp(vec3(1.0)-baseSpecularEnergy,0.0,1.0);\n#endif\n#endif\n#if defined(CLEARCOAT)\nfinalIrradiance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nfinalIrradiance*=clearcoatOut.absorption;\n#endif\n#endif\n#ifndef SS_APPLY_ALBEDO_AFTER_SUBSURFACE\nfinalIrradiance*=surfaceAlbedo.rgb;\n#endif\n#if defined(SS_REFRACTION)\nfinalIrradiance*=subSurfaceOut.refractionOpacity;\n#endif\n#if defined(SS_TRANSLUCENCY)\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance;\n#endif\n#ifdef SS_APPLY_ALBEDO_AFTER_SUBSURFACE\nfinalIrradiance*=surfaceAlbedo.rgb;\n#endif\nfinalIrradiance*=vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;finalSpecular=max(finalSpecular,0.0);vec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalSpecularScaled*=coloredEnergyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef REFLECTION\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;finalRadiance*=colorSpecularEnvironmentReflectance;vec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalRadianceScaled*=coloredEnergyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef SHEEN\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,0.0);vec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef CLEARCOAT\nvec3 finalClearCoat=clearCoatBase;finalClearCoat=max(finalClearCoat,0.0);vec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\n#ifdef CLEARCOAT_TINT\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#if defined(CLEARCOAT)\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\n#endif\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const pbrBlockFinalLitComponents = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"pbrBlockFinalLitComponents.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrBlockFinalLitComponents.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAC1C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Gd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"pbrBlockFinalLitComponents\";\nconst shader = `aggShadow=aggShadow/numLights;\n#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 baseSpecularEnergyConservationFactor=getEnergyConservationFactor(vec3(reflectanceF0),environmentBrdf);vec3 coloredEnergyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\n#endif\n#endif\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\n#endif\n#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION\n#ifndef METALLICWORKFLOW\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\nsurfaceAlbedo.rgb=(1.-reflectanceF0)*surfaceAlbedo.rgb;\n#endif\n#endif\n#endif\n#ifdef REFLECTION\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\n#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION\n#if defined(METALLICWORKFLOW) || defined(SPECULAR_GLOSSINESS_ENERGY_CONSERVATION)\nvec3 baseSpecularEnergy=vec3(baseSpecularEnvironmentReflectance);\n#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nbaseSpecularEnergy*=baseSpecularEnergyConservationFactor;\n#endif\n#endif\nfinalIrradiance*=clamp(vec3(1.0)-baseSpecularEnergy,0.0,1.0);\n#endif\n#endif\n#if defined(CLEARCOAT)\nfinalIrradiance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nfinalIrradiance*=clearcoatOut.absorption;\n#endif\n#endif\n#ifndef SS_APPLY_ALBEDO_AFTER_SUBSURFACE\nfinalIrradiance*=surfaceAlbedo.rgb;\n#endif\n#if defined(SS_REFRACTION) && !defined(LEGACY_SPECULAR_ENERGY_CONSERVATION) \nfinalIrradiance*=subSurfaceOut.refractionOpacity;\n#endif\n#if defined(SS_TRANSLUCENCY)\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance;\n#endif\n#ifdef SS_APPLY_ALBEDO_AFTER_SUBSURFACE\nfinalIrradiance*=surfaceAlbedo.rgb;\n#endif\nfinalIrradiance*=vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;finalSpecular=max(finalSpecular,0.0);vec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalSpecularScaled*=coloredEnergyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef REFLECTION\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;finalRadiance*=colorSpecularEnvironmentReflectance;vec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalRadianceScaled*=coloredEnergyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef SHEEN\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,0.0);vec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef CLEARCOAT\nvec3 finalClearCoat=clearCoatBase;finalClearCoat=max(finalClearCoat,0.0);vec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\n#ifdef CLEARCOAT_TINT\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#if defined(CLEARCOAT)\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\n#endif\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const pbrBlockFinalLitComponents = { name, shader };\n"]}
|