@babylonjs/core 9.4.1 → 9.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/Cameras/Inputs/freeCameraTouchInput.js +5 -3
  2. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  3. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +11 -7
  4. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
  5. package/Cameras/arcRotateCamera.js +2 -1
  6. package/Cameras/arcRotateCamera.js.map +1 -1
  7. package/Cameras/camera.js +1 -0
  8. package/Cameras/camera.js.map +1 -1
  9. package/Cameras/followCamera.js +1 -1
  10. package/Cameras/followCamera.js.map +1 -1
  11. package/Collisions/gpuPicker.d.ts +12 -0
  12. package/Collisions/gpuPicker.js +51 -0
  13. package/Collisions/gpuPicker.js.map +1 -1
  14. package/Culling/ray.core.js +46 -2
  15. package/Culling/ray.core.js.map +1 -1
  16. package/Engines/Native/nativeHelpers.js +26 -0
  17. package/Engines/Native/nativeHelpers.js.map +1 -1
  18. package/Engines/WebGPU/webgpuTextureHelper.js +26 -0
  19. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  20. package/Engines/abstractEngine.js +2 -2
  21. package/Engines/abstractEngine.js.map +1 -1
  22. package/Engines/constants.d.ts +52 -0
  23. package/Engines/constants.js +52 -0
  24. package/Engines/constants.js.map +1 -1
  25. package/Engines/engine.d.ts +13 -0
  26. package/Engines/thinEngine.js +52 -0
  27. package/Engines/thinEngine.js.map +1 -1
  28. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +10 -3
  29. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  30. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +1 -0
  31. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +36 -3
  32. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  33. package/FlowGraph/flowGraphEventBlock.d.ts +13 -0
  34. package/FlowGraph/flowGraphEventBlock.js +21 -2
  35. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  36. package/FrameGraph/frameGraphTextureManager.js +26 -0
  37. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  38. package/Layers/layer.js +5 -1
  39. package/Layers/layer.js.map +1 -1
  40. package/LensFlares/lensFlareSystem.js +1 -0
  41. package/LensFlares/lensFlareSystem.js.map +1 -1
  42. package/Lights/Clustered/clusteredLightContainer.js +11 -1
  43. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  44. package/Loading/Plugins/babylonFileLoader.js +14 -0
  45. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  46. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +1 -0
  47. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +6 -3
  48. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -1
  49. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +2 -0
  50. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +10 -3
  51. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  52. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +2 -1
  53. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +10 -4
  54. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -1
  55. package/Materials/PBR/openpbrMaterial.d.ts +11 -0
  56. package/Materials/PBR/openpbrMaterial.js +59 -12
  57. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  58. package/Materials/Textures/Loaders/ktxTextureLoader.js +26 -0
  59. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  60. package/Materials/Textures/envCubeTexture.js +33 -15
  61. package/Materials/Textures/envCubeTexture.js.map +1 -1
  62. package/Materials/material.d.ts +16 -1
  63. package/Materials/material.js +16 -1
  64. package/Materials/material.js.map +1 -1
  65. package/Materials/standardMaterial.js +4 -2
  66. package/Materials/standardMaterial.js.map +1 -1
  67. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -1
  68. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +16 -18
  69. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  70. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +24 -0
  71. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +93 -18
  72. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
  73. package/Meshes/abstractMesh.js +1 -0
  74. package/Meshes/abstractMesh.js.map +1 -1
  75. package/Meshes/mesh.js +3 -0
  76. package/Meshes/mesh.js.map +1 -1
  77. package/Meshes/transformNode.d.ts +6 -0
  78. package/Meshes/transformNode.js +6 -0
  79. package/Meshes/transformNode.js.map +1 -1
  80. package/Misc/brdfTextureTools.d.ts +12 -0
  81. package/Misc/brdfTextureTools.js +22 -0
  82. package/Misc/brdfTextureTools.js.map +1 -1
  83. package/Misc/depthReducer.js +1 -1
  84. package/Misc/depthReducer.js.map +1 -1
  85. package/Misc/snapshotRenderingHelper.d.ts +7 -1
  86. package/Misc/snapshotRenderingHelper.js +7 -1
  87. package/Misc/snapshotRenderingHelper.js.map +1 -1
  88. package/Misc/textureTools.js +26 -0
  89. package/Misc/textureTools.js.map +1 -1
  90. package/Misc/tools.js +1 -1
  91. package/Misc/tools.js.map +1 -1
  92. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +17 -10
  93. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
  94. package/Particles/Node/Blocks/Update/updateNoiseBlock.js +14 -0
  95. package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
  96. package/Particles/Node/Blocks/particleSourceTextureBlock.js +114 -12
  97. package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
  98. package/Particles/Node/nodeParticleBuildState.d.ts +11 -0
  99. package/Particles/Node/nodeParticleBuildState.js +15 -0
  100. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  101. package/Particles/Node/nodeParticleSystemSet.js +23 -22
  102. package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
  103. package/Particles/gpuParticleSystem.js +1 -0
  104. package/Particles/gpuParticleSystem.js.map +1 -1
  105. package/Particles/thinParticleSystem.js +1 -0
  106. package/Particles/thinParticleSystem.js.map +1 -1
  107. package/PostProcesses/postProcessManager.d.ts +2 -0
  108. package/PostProcesses/postProcessManager.js +14 -8
  109. package/PostProcesses/postProcessManager.js.map +1 -1
  110. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +12 -9
  111. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  112. package/Rendering/depthRendererSceneComponent.js +6 -6
  113. package/Rendering/depthRendererSceneComponent.js.map +1 -1
  114. package/Rendering/iblCdfGeneratorSceneComponent.d.ts +6 -0
  115. package/Rendering/iblCdfGeneratorSceneComponent.js +16 -0
  116. package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -1
  117. package/Rendering/prePassRenderer.d.ts +4 -1
  118. package/Rendering/prePassRenderer.js +31 -9
  119. package/Rendering/prePassRenderer.js.map +1 -1
  120. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +1 -1
  121. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  122. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  123. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  124. package/Shaders/ShadersInclude/openpbrDirectLighting.js +18 -10
  125. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  126. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +36 -14
  127. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  128. package/Shaders/ShadersInclude/openpbrIblFunctions.js +8 -5
  129. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  130. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +10 -6
  131. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  132. package/Shaders/openpbr.fragment.js +14 -15
  133. package/Shaders/openpbr.fragment.js.map +1 -1
  134. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
  135. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  136. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  137. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  138. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +19 -11
  139. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  140. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js +3 -3
  141. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
  142. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +36 -14
  143. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  144. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +5 -3
  145. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  146. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +5 -6
  147. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  148. package/ShadersWGSL/openpbr.fragment.js +16 -17
  149. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  150. package/Sprites/spriteManager.js +1 -0
  151. package/Sprites/spriteManager.js.map +1 -1
  152. package/package.json +1 -1
  153. package/scene.d.ts +16 -0
  154. package/scene.js +13 -0
  155. package/scene.js.map +1 -1
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "../../tslib.es6.js";
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
3
  import { serialize, expandToProperty, addAccessorsForMaterialProperty } from "../../Misc/decorators.js";
4
- import { GetEnvironmentBRDFTexture, GetEnvironmentFuzzBRDFTexture } from "../../Misc/brdfTextureTools.js";
4
+ import { GetEnvironmentFuzzBRDFTexture, GetOpenPBREnvironmentBRDFTexture } from "../../Misc/brdfTextureTools.js";
5
5
  import { Color3 } from "../../Maths/math.color.js";
6
6
  import { ImageProcessingConfiguration } from "../imageProcessingConfiguration.js";
7
7
  import { Texture } from "../Textures/texture.js";
@@ -56,6 +56,13 @@ class Uniform {
56
56
  }
57
57
  constructor(name, componentNum) {
58
58
  this.linkedProperties = {};
59
+ /**
60
+ * Cached key of the first entry of `linkedProperties`, set when the first
61
+ * property is linked. Used by the per-frame bind loop to avoid an
62
+ * `Object.keys(linkedProperties)[0]` allocation when reading scalar
63
+ * uniforms.
64
+ */
65
+ this.firstLinkedKey = "";
59
66
  this.name = name;
60
67
  this.numComponents = componentNum;
61
68
  }
@@ -73,8 +80,11 @@ class Property {
73
80
  * @param targetUniformComponentNum The number of components in the target uniform. All properties that are
74
81
  * packed into the same uniform must agree on the size of the target uniform.
75
82
  * @param targetUniformComponentOffset The offset in the uniform where this property will be packed.
83
+ * @param requiredDefine Optional define name. When provided, the per-frame
84
+ * bind loop will skip pushing the owning uniform to the UBO unless
85
+ * `defines[requiredDefine]` is true.
76
86
  */
77
- constructor(name, defaultValue, targetUniformName, targetUniformComponentNum, targetUniformComponentOffset = 0) {
87
+ constructor(name, defaultValue, targetUniformName, targetUniformComponentNum, targetUniformComponentOffset = 0, requiredDefine) {
78
88
  // public includeAlphaFromProp: string = "";
79
89
  /**
80
90
  * If not given a type, there will be no uniform defined for this property and
@@ -88,6 +98,7 @@ class Property {
88
98
  this.value = defaultValue;
89
99
  this.targetUniformComponentNum = targetUniformComponentNum;
90
100
  this.targetUniformComponentOffset = targetUniformComponentOffset;
101
+ this.requiredDefine = requiredDefine;
91
102
  }
92
103
  /**
93
104
  * Returns the number of components of the property based on its default value type.
@@ -242,6 +253,11 @@ export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRM
242
253
  * Enables the use of screen-space irradiance texture for scattering
243
254
  */
244
255
  this.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING = false;
256
+ /**
257
+ * Indicates that the irradiance texture is from the legacy GeometryBufferRenderer.
258
+ * We use this to handle direct lights which don't render in the legacy GBuffer irradiance.
259
+ */
260
+ this.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER = false;
245
261
  /**
246
262
  * Enables transmission slab
247
263
  */
@@ -554,14 +570,14 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
554
570
  this._transmissionDispersionScale = new Property("transmission_dispersion_scale", 0.0, "vTransmissionDispersionScale", 1, 0);
555
571
  this._transmissionDispersionScaleTexture = new Sampler("transmission_dispersion_scale", "transmissionDispersionScale", "TRANSMISSION_DISPERSION_SCALE");
556
572
  this._transmissionDispersionAbbeNumber = new Property("transmission_dispersion_abbe_number", 20.0, "vTransmissionDispersionAbbeNumber", 1, 0);
557
- this._subsurfaceWeight = new Property("subsurface_weight", 0.0, "vSubsurfaceWeight", 1, 0);
573
+ this._subsurfaceWeight = new Property("subsurface_weight", 0.0, "vSubsurfaceWeight", 1, 0, "SUBSURFACE_SLAB");
558
574
  this._subsurfaceWeightTexture = new Sampler("subsurface_weight", "subsurfaceWeight", "SUBSURFACE_WEIGHT");
559
- this._subsurfaceColor = new Property("subsurface_color", new Color3(0.8, 0.8, 0.8), "vSubsurfaceColor", 3, 0);
575
+ this._subsurfaceColor = new Property("subsurface_color", new Color3(0.8, 0.8, 0.8), "vSubsurfaceColor", 3, 0, "SUBSURFACE_SLAB");
560
576
  this._subsurfaceColorTexture = new Sampler("subsurface_color", "subsurfaceColor", "SUBSURFACE_COLOR");
561
- this._subsurfaceRadius = new Property("subsurface_radius", 1.0, "vSubsurfaceRadius", 1, 0);
562
- this._subsurfaceRadiusScale = new Property("subsurface_radius_scale", new Color3(1, 0.5, 0.25), "vSubsurfaceRadiusScale", 3, 0);
577
+ this._subsurfaceRadius = new Property("subsurface_radius", 1.0, "vSubsurfaceRadius", 1, 0, "SUBSURFACE_SLAB");
578
+ this._subsurfaceRadiusScale = new Property("subsurface_radius_scale", new Color3(1, 0.5, 0.25), "vSubsurfaceRadiusScale", 3, 0, "SUBSURFACE_SLAB");
563
579
  this._subsurfaceRadiusScaleTexture = new Sampler("subsurface_radius_scale", "subsurfaceRadiusScale", "SUBSURFACE_RADIUS_SCALE");
564
- this._subsurfaceScatterAnisotropy = new Property("subsurface_scatter_anisotropy", 0.0, "vSubsurfaceScatterAnisotropy", 1, 0);
580
+ this._subsurfaceScatterAnisotropy = new Property("subsurface_scatter_anisotropy", 0.0, "vSubsurfaceScatterAnisotropy", 1, 0, "SUBSURFACE_SLAB");
565
581
  this._coatWeight = new Property("coat_weight", 0.0, "vCoatWeight", 1, 0);
566
582
  this._coatWeightTexture = new Sampler("coat_weight", "coatWeight", "COAT_WEIGHT");
567
583
  this._coatColor = new Property("coat_color", Color3.White(), "vCoatColor", 3, 0);
@@ -608,6 +624,12 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
608
624
  this._sssIrradianceTexture = null;
609
625
  this._sssDepthTexture = null;
610
626
  this._uniformsList = {};
627
+ /**
628
+ * Flat array view of `_uniformsList`, populated once at construction. Used
629
+ * by the per-frame bind loop to avoid `Object.values()` allocation and
630
+ * closure creation on every submesh binding.
631
+ */
632
+ this._uniformsArray = [];
611
633
  this._samplersList = {};
612
634
  this._samplerDefines = {};
613
635
  /**
@@ -995,7 +1017,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
995
1017
  this._callbackPluginEventFillRenderTargetTextures(this._eventInfo);
996
1018
  return this._renderTargets;
997
1019
  };
998
- this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());
1020
+ this._environmentBRDFTexture = GetOpenPBREnvironmentBRDFTexture(this.getScene());
999
1021
  this._environmentFuzzBRDFTexture = GetEnvironmentFuzzBRDFTexture(this.getScene());
1000
1022
  this.prePassConfiguration = new PrePassConfiguration();
1001
1023
  // Build the internal property list that can be used to generate and update the uniform buffer
@@ -1014,13 +1036,23 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
1014
1036
  let uniform = this._uniformsList[prop.targetUniformName];
1015
1037
  if (!uniform) {
1016
1038
  uniform = new Uniform(prop.targetUniformName, prop.targetUniformComponentNum);
1039
+ uniform.requiredDefine = prop.requiredDefine;
1017
1040
  this._uniformsList[prop.targetUniformName] = uniform;
1018
1041
  }
1019
1042
  else if (uniform.numComponents !== prop.targetUniformComponentNum) {
1020
1043
  Logger.Error(`Uniform ${prop.targetUniformName} already exists of size ${uniform.numComponents}, but trying to set it to ${prop.targetUniformComponentNum}.`);
1021
1044
  }
1045
+ else if (uniform.requiredDefine !== prop.requiredDefine) {
1046
+ // Properties packed into the same uniform must share the same gating
1047
+ // define, otherwise we cannot safely skip the per-frame UBO update.
1048
+ uniform.requiredDefine = undefined;
1049
+ }
1050
+ if (uniform.firstLinkedKey === "") {
1051
+ uniform.firstLinkedKey = prop.name;
1052
+ }
1022
1053
  uniform.linkedProperties[prop.name] = prop;
1023
1054
  });
1055
+ this._uniformsArray = Object.values(this._uniformsList);
1024
1056
  // Build the internal list of samplers
1025
1057
  this._samplersList = {};
1026
1058
  for (const key of Object.getOwnPropertyNames(this)) {
@@ -1519,7 +1551,16 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
1519
1551
  if (this.pointsCloud) {
1520
1552
  ubo.updateFloat("pointSize", this.pointSize);
1521
1553
  }
1522
- Object.values(this._uniformsList).forEach((uniform) => {
1554
+ const uniformsArray = this._uniformsArray;
1555
+ for (let i = 0, len = uniformsArray.length; i < len; i++) {
1556
+ const uniform = uniformsArray[i];
1557
+ // Skip uniforms whose define is currently inactive. The shader only
1558
+ // reads them inside the same #ifdef block, so the UBO bytes can stay
1559
+ // stale. The full update will happen on the next bind once the
1560
+ // define becomes active again.
1561
+ if (uniform.requiredDefine !== undefined && !defines[uniform.requiredDefine]) {
1562
+ continue;
1563
+ }
1523
1564
  // If the property actually defines a uniform, update it.
1524
1565
  if (uniform.numComponents === 4) {
1525
1566
  uniform.populateVectorFromLinkedProperties(TmpVectors.Vector4[0]);
@@ -1534,9 +1575,9 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
1534
1575
  ubo.updateFloat2(uniform.name, TmpVectors.Vector2[0].x, TmpVectors.Vector2[0].y);
1535
1576
  }
1536
1577
  else if (uniform.numComponents === 1) {
1537
- ubo.updateFloat(uniform.name, uniform.linkedProperties[Object.keys(uniform.linkedProperties)[0]].value);
1578
+ ubo.updateFloat(uniform.name, uniform.linkedProperties[uniform.firstLinkedKey].value);
1538
1579
  }
1539
- });
1580
+ }
1540
1581
  // Misc
1541
1582
  this._lightingInfos.x = this.directIntensity;
1542
1583
  this._lightingInfos.y = this.emissionLuminance;
@@ -1693,7 +1734,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
1693
1734
  dispose(forceDisposeEffect, forceDisposeTextures) {
1694
1735
  this._breakShaderLoadedCheck = true;
1695
1736
  if (forceDisposeTextures) {
1696
- if (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture) {
1737
+ if (this._environmentBRDFTexture && this.getScene().openPBREnvironmentBRDFTexture !== this._environmentBRDFTexture) {
1697
1738
  this._environmentBRDFTexture.dispose();
1698
1739
  }
1699
1740
  if (this._environmentFuzzBRDFTexture && this.getScene().environmentFuzzBRDFTexture !== this._environmentFuzzBRDFTexture) {
@@ -2111,16 +2152,22 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
2111
2152
  // Determine whether we should use the prepass irradiance texture for scattering.
2112
2153
  // If this IS a prepass, we don't want to use the irradiance texture as it won't be available yet.
2113
2154
  if (!defines.PREPASS && (defines.SUBSURFACE_SLAB || defines.TRANSMISSION_SLAB_VOLUME)) {
2155
+ let usingGBuffer = false;
2114
2156
  if (!this.sssIrradianceTexture && scene.geometryBufferRenderer) {
2115
2157
  const irradianceTextureIndex = scene.geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.IRRADIANCE_TEXTURE_TYPE);
2116
2158
  this.sssIrradianceTexture = scene.geometryBufferRenderer.getGBuffer().textures[irradianceTextureIndex];
2159
+ usingGBuffer = true;
2117
2160
  }
2118
2161
  if (!this.sssDepthTexture && scene.geometryBufferRenderer) {
2119
2162
  const depthIndex = scene.geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.SCREENSPACE_DEPTH_TEXTURE_TYPE);
2120
2163
  this.sssDepthTexture = scene.geometryBufferRenderer.getGBuffer().textures[depthIndex];
2164
+ usingGBuffer = true;
2121
2165
  }
2122
2166
  if (this.sssIrradianceTexture && this.sssDepthTexture) {
2123
2167
  defines.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING = true;
2168
+ if (usingGBuffer) {
2169
+ defines.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING_GBUFFER = true;
2170
+ }
2124
2171
  }
2125
2172
  }
2126
2173
  defines.FUZZ = this.fuzzWeight > 0 && MaterialFlags.ReflectionTextureEnabled;