Browse Source

Fix Legacy refraction.

sebavan 6 years ago
parent
commit
126137d9fd
1 changed files with 9 additions and 0 deletions
  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>) {
     public set refractionTexture(value: Nullable<BaseTexture>) {
         this.subSurface.refractionTexture = value;
         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) {
     public set linkRefractionWithTransparency(value: boolean) {
         this.subSurface.linkRefractionWithTransparency = value;
         this.subSurface.linkRefractionWithTransparency = value;
+        if (value) {
+            this.subSurface.isRefractionEnabled = true;
+        }
     }
     }
 
 
     /**
     /**