From abc0497f241e0771c3e1a5e37acf6a283afbe18b Mon Sep 17 00:00:00 2001 From: Deltakosh Date: Thu, 7 Nov 2024 09:49:56 -0800 Subject: [PATCH] Fix #15786 --- packages/dev/addons/src/htmlMesh/htmlMeshRenderer.ts | 4 ++++ .../src/PostProcesses/volumetricLightScatteringPostProcess.ts | 1 - .../core/src/Shaders/volumetricLightScattering.fragment.fx | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/dev/addons/src/htmlMesh/htmlMeshRenderer.ts b/packages/dev/addons/src/htmlMesh/htmlMeshRenderer.ts index 9180c8dd356..1796ae3196a 100644 --- a/packages/dev/addons/src/htmlMesh/htmlMeshRenderer.ts +++ b/packages/dev/addons/src/htmlMesh/htmlMeshRenderer.ts @@ -298,6 +298,10 @@ export class HtmlMeshRenderer { this._height = height; this._heightHalf = this._height / 2; + if (!this._inSceneElements || !this._overlayElements) { + return; + } + const domElements = [this._inSceneElements!.domElement, this._overlayElements!.domElement, this._inSceneElements!.cameraElement, this._overlayElements!.cameraElement]; domElements.forEach((dom) => { if (dom) { diff --git a/packages/dev/core/src/PostProcesses/volumetricLightScatteringPostProcess.ts b/packages/dev/core/src/PostProcesses/volumetricLightScatteringPostProcess.ts index 7a812024306..982fb9d22bd 100644 --- a/packages/dev/core/src/PostProcesses/volumetricLightScatteringPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/volumetricLightScatteringPostProcess.ts @@ -161,7 +161,6 @@ export class VolumetricLightScatteringPostProcess extends PostProcess { // Configure mesh this.mesh = mesh ?? VolumetricLightScatteringPostProcess.CreateDefaultMesh("VolumetricLightScatteringMesh", scene); - // Configure this._createPass(scene, ratio.passRatio || ratio); diff --git a/packages/dev/core/src/Shaders/volumetricLightScattering.fragment.fx b/packages/dev/core/src/Shaders/volumetricLightScattering.fragment.fx index aff7f00ade1..db233a09c55 100644 --- a/packages/dev/core/src/Shaders/volumetricLightScattering.fragment.fx +++ b/packages/dev/core/src/Shaders/volumetricLightScattering.fragment.fx @@ -33,7 +33,7 @@ void main(void) { } vec4 realColor = texture2D(textureSampler, vUV); - gl_FragColor = ((vec4((vec3(color.r, color.g, color.b) * exposure), 1)) + (realColor * (1.5 - 0.4))); + gl_FragColor = ((vec4((vec3(color.r, color.g, color.b) * exposure), realColor.a)) + (realColor * (1.5 - 0.4))); #define CUSTOM_FRAGMENT_MAIN_END }