|
|
|
|
|
|
float3 V = float3(sqrt(1 - NdotV * NdotV), 0, NdotV); |
|
|
|
|
|
|
|
float fDir = ComputeGgxEnergyCompensationFactor(V, N, roughness); |
|
|
|
|
|
|
|
#define MS_GGX_IMAGEWORKS 0 |
|
|
|
|
|
|
|
#if MS_GGX_IMAGEWORKS |
|
|
|
float fAvg = 0; |
|
|
|
|
|
|
|
const uint numSamples = 128; |
|
|
|
|
|
|
fAvg += ComputeGgxEnergyCompensationFactor(V, N, roughness) * NdotV * (2 * rcp(numSamples)); |
|
|
|
} |
|
|
|
|
|
|
|
// f_ms = f[NdotV, perceptualRoughness] * f[NdotL, perceptualRoughness]. |
|
|
|
#else |
|
|
|
// f_ms = f[NdotV, perceptualRoughness] * f_ss. |
|
|
|
float f = 1 / fDir - 1; |
|
|
|
#endif |
|
|
|
// f_ms = f[NdotV, perceptualRoughness] * f[NdotL, perceptualRoughness]. |
|
|
|
return f.xxxx; |
|
|
|
} |
|
|
|
|
|
|
|