瀏覽代碼

Fix spotlights for PBR

David Catuhe 8 年之前
父節點
當前提交
638d3abf57
共有 3 個文件被更改,包括 5856 次插入5852 次删除
  1. 2927 2925
      dist/preview release/babylon.d.ts
  2. 2927 2925
      dist/preview release/babylon.module.d.ts
  3. 2 2
      src/Shaders/ShadersInclude/pbrLightFunctions.fx

File diff suppressed because it is too large
+ 2927 - 2925
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 2927 - 2925
dist/preview release/babylon.module.d.ts


+ 2 - 2
src/Shaders/ShadersInclude/pbrLightFunctions.fx

@@ -113,8 +113,8 @@ lightingInfo computeSpotLighting(vec3 viewDirectionW, vec3 vNormal, vec4 lightDa
     roughness = adjustRoughnessFromLightProperties(roughness, rangeRadius, lightDistance);
     
     // Diffuse
-    vec3 H = normalize(viewDirectionW - lightDirection.xyz);
-    NdotL = max(0.00000000001, dot(vNormal, -lightDirection.xyz));
+    vec3 H = normalize(viewDirectionW + directionToLightCenterW);
+    NdotL = max(0.00000000001, dot(vNormal, directionToLightCenterW));
     float VdotH = clamp(dot(viewDirectionW, H), 0.00000000001, 1.0);
 
     float diffuseTerm = computeDiffuseTerm(NdotL, NdotV, VdotH, roughness);