Parcourir la source

Fix mirrored camera perturb normal node

Sebastien Vandenberghe il y a 5 ans
Parent
commit
a5b619afd5
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      src/Materials/Node/Blocks/Fragment/perturbNormalBlock.ts

+ 5 - 1
src/Materials/Node/Blocks/Fragment/perturbNormalBlock.ts

@@ -98,7 +98,11 @@ export class PerturbNormalBlock extends NodeMaterialBlock {
     }
     }
 
 
     public bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {
     public bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {
-        effect.setFloat2(this._tangentSpaceParameterName, this.invertX ? -1 : 1, this.invertY ? -1 : 1);
+        if (nodeMaterial.getScene()._mirroredCameraPosition) {
+            effect.setFloat2("vTangentSpaceParams", this.invertX ? 1.0 : -1.0, this.invertY ? 1.0 : -1.0);
+        } else {
+            effect.setFloat2("vTangentSpaceParams", this.invertX ? -1.0 : 1.0, this.invertY ? -1.0 : 1.0);
+        }
     }
     }
 
 
     public autoConfigure(material: NodeMaterial) {
     public autoConfigure(material: NodeMaterial) {