Browse Source

Remove the linear blend method

Popov72 5 năm trước cách đây
mục cha
commit
d3f958e914

+ 2 - 8
src/Materials/material.ts

@@ -155,22 +155,16 @@ export class Material implements IAnimatable {
     public static readonly MATERIAL_ALPHATESTANDBLEND = 3;
 
     /**
-     * The linear method is used to blend normals.
-     * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
-     */
-    public static readonly MATERIAL_NORMALBLENDMETHOD_LINEAR = 0;
-
-    /**
      * The Whiteout method is used to blend normals.
      * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
      */
-    public static readonly MATERIAL_NORMALBLENDMETHOD_WHITEOUT = 1;
+    public static readonly MATERIAL_NORMALBLENDMETHOD_WHITEOUT = 0;
 
     /**
      * The Reoriented Normal Mapping method is used to blend normals.
      * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
      */
-    public static readonly MATERIAL_NORMALBLENDMETHOD_RNM = 2;
+    public static readonly MATERIAL_NORMALBLENDMETHOD_RNM = 1;
 
     /**
      * Custom callback helping to override the default shader used in the material.

+ 1 - 1
src/Materials/standardMaterial.ts

@@ -1425,7 +1425,7 @@ export class StandardMaterial extends PushMaterial {
                     }
 
                     if (this._detailTexture && StandardMaterial.DetailTextureEnabled) {
-                        ubo.updateFloat3("vDetailInfos", this._detailTexture.coordinatesIndex, this.detailDiffuseBlendLevel, this.detailBumpLevel);
+                        ubo.updateFloat3("vDetailInfos", this._detailTexture.coordinatesIndex, 1 - this.detailDiffuseBlendLevel, this.detailBumpLevel);
                         MaterialHelper.BindTextureMatrix(this._detailTexture, ubo, "detail");
                     }
 

+ 2 - 4
src/Shaders/ShadersInclude/bumpFragment.fx

@@ -49,12 +49,10 @@
 		normalW = perturbNormal(TBN, vBumpUV + uvOffset);
     #else
         vec3 bumpNormal = texture2D(bumpSampler, vBumpUV + uvOffset).xyz * 2.0 - 1.0;
-        #if DETAIL_NORMALBLENDMETHOD == 0 // linear
-            vec3 blendedNormal = normalize(bumpNormal + detailNormal * vec3(vDetailInfos.z));
-        #elif DETAIL_NORMALBLENDMETHOD == 1 // whiteout
+        #if DETAIL_NORMALBLENDMETHOD == 0 // whiteout
             detailNormal.xy *= vDetailInfos.z;
             vec3 blendedNormal = normalize(vec3(bumpNormal.xy + detailNormal.xy, bumpNormal.z * detailNormal.z));
-        #elif DETAIL_NORMALBLENDMETHOD == 2 // RNM
+        #elif DETAIL_NORMALBLENDMETHOD == 1 // RNM
             detailNormal.xy *= vDetailInfos.z;
             bumpNormal += vec3(0.0, 0.0, 1.0);
             detailNormal *= vec3(-1.0, -1.0, 1.0);