浏览代码

native uv
visibility renaming

Cedric Guillemet 5 年之前
父节点
当前提交
e08690da77

+ 2 - 0
src/Engines/Native/nativeShaderProcessor.ts

@@ -6,6 +6,7 @@ const attributeLocations: { [kind: string]: number } = {
     [VertexBuffer.PositionKind]: 0,
     [VertexBuffer.NormalKind]: 1,
     [VertexBuffer.TangentKind]: 2,
+    [VertexBuffer.UVKind]: 10,
     [VertexBuffer.ColorKind]: 4,
     [VertexBuffer.MatricesIndicesKind]: 8,
     [VertexBuffer.MatricesWeightsKind]: 9,
@@ -15,6 +16,7 @@ const attributeBGFXName: { [kind: string]: string } = {
     [VertexBuffer.PositionKind]: "a_position",
     [VertexBuffer.NormalKind]: "a_normal",
     [VertexBuffer.TangentKind]: "a_tangent",
+    [VertexBuffer.UVKind]: "a_uv",
     [VertexBuffer.ColorKind]: "a_color",
     [VertexBuffer.MatricesIndicesKind]: "a_index",
     [VertexBuffer.MatricesWeightsKind]: "a_weight",

+ 9 - 9
src/Shaders/ShadersInclude/pbrDirectLightingFunctions.fx

@@ -72,12 +72,12 @@ vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler, m
         float distribution = normalDistributionFunction_TrowbridgeReitzGGX(NdotH, alphaG);
 
         #ifdef BRDF_V_HEIGHT_CORRELATED
-            float visibility = smithVisibility_GGXCorrelated(info.NdotL, info.NdotV, alphaG);
+            float smithVisibility = smithVisibility_GGXCorrelated(info.NdotL, info.NdotV, alphaG);
         #else
-            float visibility = smithVisibility_TrowbridgeReitzGGXFast(info.NdotL, info.NdotV, alphaG);
+            float smithVisibility = smithVisibility_TrowbridgeReitzGGXFast(info.NdotL, info.NdotV, alphaG);
         #endif
 
-        vec3 specTerm = fresnel * distribution * visibility;
+        vec3 specTerm = fresnel * distribution * smithVisibility;
         return specTerm * info.attenuation * info.NdotL * lightColor;
     }
 #endif
@@ -97,9 +97,9 @@ vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler, m
 
         vec3 fresnel = fresnelSchlickGGX(info.VdotH, reflectance0, reflectance90);
         float distribution = normalDistributionFunction_BurleyGGX_Anisotropic(NdotH, TdotH, BdotH, alphaTB);
-        float visibility = smithVisibility_GGXCorrelated_Anisotropic(info.NdotL, info.NdotV, TdotV, BdotV, TdotL, BdotL, alphaTB);
+        float smithVisibility = smithVisibility_GGXCorrelated_Anisotropic(info.NdotL, info.NdotV, TdotV, BdotV, TdotL, BdotL, alphaTB);
 
-        vec3 specTerm = fresnel * distribution * visibility;
+        vec3 specTerm = fresnel * distribution * smithVisibility;
         return specTerm * info.attenuation * info.NdotL * lightColor;
     }
 #endif
@@ -114,9 +114,9 @@ vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler, m
         float fresnel = fresnelSchlickGGX(info.VdotH, vClearCoatRefractionParams.x, CLEARCOATREFLECTANCE90);
         fresnel *= clearCoatIntensity;
         float distribution = normalDistributionFunction_TrowbridgeReitzGGX(NccdotH, alphaG);
-        float visibility = visibility_Kelemen(info.VdotH);
+        float kelemenVisibility = visibility_Kelemen(info.VdotH);
 
-        float clearCoatTerm = fresnel * distribution * visibility;
+        float clearCoatTerm = fresnel * distribution * kelemenVisibility;
 
         return vec4(
             clearCoatTerm * info.attenuation * NccdotL * lightColor,
@@ -143,9 +143,9 @@ vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler, m
         // vec3 fresnel = fresnelSchlickGGX(info.VdotH, reflectance0, reflectance90);
         vec3 fresnel = reflectance0;
         float distribution = normalDistributionFunction_CharlieSheen(NdotH, alphaG);
-        float visibility = visibility_Ashikhmin(info.NdotL, info.NdotV);
+        float ashikhminvisibility = visibility_Ashikhmin(info.NdotL, info.NdotV);
 
-        vec3 sheenTerm = fresnel * distribution * visibility;
+        vec3 sheenTerm = fresnel * distribution * ashikhminvisibility;
         return sheenTerm * info.attenuation * info.NdotL * lightColor;
     }
 #endif