@@ -506,8 +506,7 @@ PreLightData GetPreLightData(float3 V, float3 positionWS, Coordinate coord, BSDF
506506
507507 // Area light specific
508508 // UVs for sampling the LUTs
509- // TODO: Test with fastAcos
510- float theta = acos (dot (bsdfData.normalWS, V));
509+ float theta = FastACos (dot (bsdfData.normalWS, V));
511510 // Scale and bias for the current precomputed table - the constant use here are the one that have been use when the table in LtcData.DisneyDiffuse.cs and LtcData.GGX.cs was use
512511 float2 uv = 0.0078125 + 0.984375 * float2 (bsdfData.perceptualRoughness, theta * INV_HALF_PI);
513512
@@ -872,7 +871,6 @@ void EvaluateBSDF_Area( LightLoopContext lightLoopContext,
872871 }
873872
874873 #ifndef DIFFUSE_LAMBERT_BRDF
875- // TODO: verify that we do not need to multiply by PI.
876874 ltcValue *= preLightData.ltcDisneyDiffuseMagnitude;
877875 #endif
878876
@@ -889,9 +887,6 @@ void EvaluateBSDF_Area( LightLoopContext lightLoopContext,
889887 ltcValue *= lightData.specularScale;
890888 specularLighting = fresnelTerm * lightData.color * ltcValue;
891889 }
892-
893- // TODO: current area light code doesn't take into account artist attenuation radius!
894-
895890#endif
896891}
897892
@@ -905,13 +900,13 @@ float3 IntegrateLambertIBLRef( LightLoopContext lightLoopContext,
905900 uint sampleCount = 2048 )
906901{
907902 float3 N = bsdfData.normalWS;
903+ float3 tangentX = bsdfData.tangentWS;
904+ float3 tangentY = bsdfData.bitangentWS;
908905 float3 acc = float3 (0.0 , 0.0 , 0.0 );
906+
909907 // Add some jittering on Hammersley2d
910908 float2 randNum = InitRandom (N.xy * 0.5 + 0.5 );
911909
912- float3 tangentX, tangentY;
913- GetLocalFrame (N, tangentX, tangentY);
914-
915910 for (uint i = 0 ; i < sampleCount; ++i)
916911 {
917912 float2 u = Hammersley2d (i, sampleCount);
@@ -938,15 +933,15 @@ float3 IntegrateDisneyDiffuseIBLRef(LightLoopContext lightLoopContext,
938933 float3 V, EnvLightData lightData, BSDFData bsdfData,
939934 uint sampleCount = 2048 )
940935{
941- float3 N = bsdfData.normalWS;
942- float NdotV = dot (N, V);
943- float3 acc = float3 (0.0 , 0.0 , 0.0 );
936+ float3 N = bsdfData.normalWS;
937+ float3 tangentX = bsdfData.tangentWS;
938+ float3 tangentY = bsdfData.bitangentWS;
939+ float NdotV = saturate (dot (N, V));
940+ float3 acc = float3 (0.0 , 0.0 , 0.0 );
941+
944942 // Add some jittering on Hammersley2d
945943 float2 randNum = InitRandom (N.xy * 0.5 + 0.5 );
946944
947- float3 tangentX, tangentY;
948- GetLocalFrame (N, tangentX, tangentY);
949-
950945 for (uint i = 0 ; i < sampleCount; ++i)
951946 {
952947 float2 u = Hammersley2d (i, sampleCount);
@@ -981,15 +976,14 @@ float3 IntegrateSpecularGGXIBLRef( LightLoopContext lightLoopContext,
981976 uint sampleCount = 2048 )
982977{
983978 float3 N = bsdfData.normalWS;
984- float NdotV = saturate (dot (N, V));
979+ float3 tangentX = bsdfData.tangentWS;
980+ float3 tangentY = bsdfData.bitangentWS;
981+ float NdotV = saturate (dot (N, V));
985982 float3 acc = float3 (0.0 , 0.0 , 0.0 );
986983
987984 // Add some jittering on Hammersley2d
988985 float2 randNum = InitRandom (V.xy * 0.5 + 0.5 );
989986
990- float3 tangentX, tangentY;
991- GetLocalFrame (N, tangentX, tangentY);
992-
993987 for (uint i = 0 ; i < sampleCount; ++i)
994988 {
995989 float2 u = Hammersley2d (i, sampleCount);
@@ -1047,7 +1041,7 @@ void EvaluateBSDF_Env( LightLoopContext lightLoopContext,
10471041*/
10481042 diffuseLighting = float3 (0.0 , 0.0 , 0.0 );
10491043
1050- weight = float2 (0.0 , 0 .0 );
1044+ weight = float2 (0.0 , 1 .0 );
10511045
10521046#else
10531047 // TODO: factor this code in common, so other material authoring don't require to rewrite everything,
0 commit comments