Rename BRDF visibility functions prefix to V_ from Vis_
This commit is contained in:
@@ -102,7 +102,7 @@ GPU_CB_STRUCT(ShaderEnvProbeData {
|
||||
Float4 Data2;
|
||||
});
|
||||
|
||||
// Minimum roughness value used for shading (prevent 0 roughness which causes NaNs in Vis_SmithJointApprox)
|
||||
// Minimum roughness value used for shading (prevent 0 roughness which causes NaNs in V_SmithJointApprox)
|
||||
#define MIN_ROUGHNESS 0.04f
|
||||
|
||||
// Maximum amount of directional light cascades (using CSM technique)
|
||||
|
||||
@@ -61,12 +61,12 @@ namespace PreIntegratedGF
|
||||
return Float3(sinTheta * cosf(phi), sinTheta * sinf(phi), cosTheta);
|
||||
}
|
||||
|
||||
float Vis_SmithJointApprox(float roughness, float NoV, float NoL)
|
||||
float V_SmithJointApprox(float roughness, float NoV, float NoL)
|
||||
{
|
||||
float a = roughness * roughness;
|
||||
float Vis_SmithV = NoL * (NoV * (1 - a) + a);
|
||||
float Vis_SmithL = NoV * (NoL * (1 - a) + a);
|
||||
return 0.5f / (Vis_SmithV + Vis_SmithL);
|
||||
float V_SmithV = NoL * (NoV * (1 - a) + a);
|
||||
float V_SmithL = NoV * (NoL * (1 - a) + a);
|
||||
return 0.5f / (V_SmithV + V_SmithL);
|
||||
}
|
||||
|
||||
Float2 IntegrateBRDF(float roughness, float NoV)
|
||||
@@ -87,12 +87,12 @@ namespace PreIntegratedGF
|
||||
|
||||
if (NoL > 0)
|
||||
{
|
||||
float Vis = Vis_SmithJointApprox(roughness, NoV, NoL);
|
||||
float NoL_Vis_PDF = NoL * Vis * (4 * VoH / NoH);
|
||||
float Vis = V_SmithJointApprox(roughness, NoV, NoL);
|
||||
float NoL_V_PDF = NoL * Vis * (4 * VoH / NoH);
|
||||
|
||||
float Fc = powf(1 - VoH, 5);
|
||||
a += NoL_Vis_PDF * (1 - Fc);
|
||||
b += NoL_Vis_PDF * Fc;
|
||||
a += NoL_V_PDF * (1 - Fc);
|
||||
b += NoL_V_PDF * Fc;
|
||||
}
|
||||
}
|
||||
return Float2(a, b) / (float)NumSamples;
|
||||
|
||||
@@ -20,9 +20,9 @@ float D_GGX(float roughness, float NoH)
|
||||
return a2 / (PI * d * d);
|
||||
}
|
||||
|
||||
// Tuned to match behavior of Vis_Smith
|
||||
// Tuned to match behavior of V_Smith
|
||||
// [Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering"]
|
||||
float Vis_Schlick(float roughness, float NoV, float NoL)
|
||||
float V_Schlick(float roughness, float NoV, float NoL)
|
||||
{
|
||||
float k = Square(roughness) * 0.5;
|
||||
float visSchlickV = NoV * (1 - k) + k;
|
||||
@@ -32,7 +32,7 @@ float Vis_Schlick(float roughness, float NoV, float NoL)
|
||||
|
||||
// Smith term for GGX
|
||||
// [Smith 1967, "Geometrical shadowing of a random rough surface"]
|
||||
float Vis_Smith(float roughness, float NoV, float NoL)
|
||||
float V_Smith(float roughness, float NoV, float NoL)
|
||||
{
|
||||
float a = Square(roughness);
|
||||
float a2 = a * a;
|
||||
@@ -43,7 +43,7 @@ float Vis_Smith(float roughness, float NoV, float NoL)
|
||||
|
||||
// Appoximation of joint Smith term for GGX
|
||||
// [Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"]
|
||||
float Vis_SmithJointApprox(float roughness, float NoV, float NoL)
|
||||
float V_SmithJointApprox(float roughness, float NoV, float NoL)
|
||||
{
|
||||
float a = Square(roughness);
|
||||
float visSmithV = NoL * (NoV * (1 - a) + a);
|
||||
|
||||
@@ -35,7 +35,7 @@ LightSample StandardShading(GBufferSample gBuffer, float energy, float3 L, float
|
||||
float3 specularColor = GetSpecularColor(gBuffer);
|
||||
float3 F = F_Schlick(specularColor, VoH);
|
||||
float D = D_GGX(gBuffer.Roughness, NoH) * energy;
|
||||
float Vis = Vis_SmithJointApprox(gBuffer.Roughness, NoV, NoL);
|
||||
float Vis = V_SmithJointApprox(gBuffer.Roughness, NoV, NoL);
|
||||
// TODO: apply energy compensation to specular (1.0 + specularColor * (1.0 / PreIntegratedGF.y - 1.0))
|
||||
lighting.Specular = (D * Vis) * F;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user