Browse Source

Mesh visibility not applied correctly when material frozen

Popov72 5 years ago
parent
commit
0e71f3bc49
3 changed files with 7 additions and 6 deletions
  1. 1 0
      dist/what's new.md
  2. 3 3
      src/Materials/PBR/pbrBaseMaterial.ts
  3. 3 3
      src/Materials/standardMaterial.ts

+ 1 - 0
dist/what's new.md

@@ -353,6 +353,7 @@
 - Fix for bug where comments would break out of frames and break resizing of frames ([Kyle Belfort](https://github.com/belfortk))
 - Fix for bug where frames without comments would display undefined at the bottom right corner ([Kyle Belfort](https://github.com/belfortk))
 - Fixed an issue in XR where one of the cameras used for rendering got the wrong framebuffer dimensions ([RaananW](https://github.com/RaananW/))
+- Fix bug in `StandardMaterial` and `PBRMaterial` where the mesh visibility value is not applied correctly when the material is frozen ([Popov72](https://github.com/Popov72))
 
 ## Breaking changes
 

+ 3 - 3
src/Materials/PBR/pbrBaseMaterial.ts

@@ -1788,9 +1788,6 @@ export abstract class PBRBaseMaterial extends PushMaterial {
                     ubo.updateColor4("vAlbedoColor", this._albedoColor, this.alpha);
                 }
 
-                // Visibility
-                ubo.updateFloat("visibility", mesh.visibility);
-
                 // Misc
                 this._lightingInfos.x = this._directIntensity;
                 this._lightingInfos.y = this._emissiveIntensity;
@@ -1800,6 +1797,9 @@ export abstract class PBRBaseMaterial extends PushMaterial {
                 ubo.updateVector4("vLightingIntensity", this._lightingInfos);
             }
 
+            // Visibility
+            ubo.updateFloat("visibility", mesh.visibility);
+
             // Textures
             if (scene.texturesEnabled) {
                 if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {

+ 3 - 3
src/Materials/standardMaterial.ts

@@ -1436,13 +1436,13 @@ export class StandardMaterial extends PushMaterial {
                 }
                 ubo.updateColor3("vEmissiveColor", StandardMaterial.EmissiveTextureEnabled ? this.emissiveColor : Color3.BlackReadOnly);
 
-                // Visibility
-                ubo.updateFloat("visibility", mesh.visibility);
-
                 // Diffuse
                 ubo.updateColor4("vDiffuseColor", this.diffuseColor, this.alpha);
             }
 
+            // Visibility
+            ubo.updateFloat("visibility", mesh.visibility);
+
             // Textures
             if (scene.texturesEnabled) {
                 if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {