Ver código fonte

Fix Legacy refraction.

sebavan 6 anos atrás
pai
commit
126137d9fd
1 arquivos alterados com 9 adições e 0 exclusões
  1. 9 0
      src/Materials/PBR/pbrMaterial.ts

+ 9 - 0
src/Materials/PBR/pbrMaterial.ts

@@ -196,6 +196,12 @@ export class PBRMaterial extends PBRBaseMaterial {
     }
     public set refractionTexture(value: Nullable<BaseTexture>) {
         this.subSurface.refractionTexture = value;
+        if (value) {
+            this.subSurface.isRefractionEnabled = true;
+        }
+        else if (!this.subSurface.linkRefractionWithTransparency) {
+            this.subSurface.isRefractionEnabled = false;
+        }
     }
 
     /**
@@ -269,6 +275,9 @@ export class PBRMaterial extends PBRBaseMaterial {
     }
     public set linkRefractionWithTransparency(value: boolean) {
         this.subSurface.linkRefractionWithTransparency = value;
+        if (value) {
+            this.subSurface.isRefractionEnabled = true;
+        }
     }
 
     /**