|
|
|
|
|
|
// Ref: Moving Frostbite to PBR (Appendix A) |
|
|
|
float3 IntegrateSpecularGGXIBLRef(LightLoopContext lightLoopContext, |
|
|
|
float3 V, PreLightData preLightData, EnvLightData lightData, BSDFData bsdfData, |
|
|
|
uint sampleCount = 4096) |
|
|
|
uint sampleCount = 2048) |
|
|
|
float3x3 localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS); |
|
|
|
float3x3 localToWorld; |
|
|
|
|
|
|
|
if (bsdfData.materialId == MATERIALID_LIT_ANISO) |
|
|
|
{ |
|
|
|
localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// We do not have a tangent frame unless we use anisotropic GGX. |
|
|
|
localToWorld = GetLocalFrame(bsdfData.normalWS); |
|
|
|
} |
|
|
|
|
|
|
|
float NdotV = max(preLightData.NdotV, MIN_N_DOT_V); |
|
|
|
float3 acc = float3(0.0, 0.0, 0.0); |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
ImportanceSampleGGX(u, V, localToWorld, bsdfData.roughness, NdotV, L, VdotH, NdotL, weightOverPdf); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (NdotL > 0.0) |
|
|
|
{ |
|
|
|