浏览代码

Remove HeavisideStep() from G_MaskingSmithGGX()

/stochastic_alpha_test
Evgenii Golubev 7 年前
当前提交
5c39d899
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 11
      ScriptableRenderPipeline/Core/ShaderLibrary/BSDF.hlsl

11
ScriptableRenderPipeline/Core/ShaderLibrary/BSDF.hlsl


}
// Ref: Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs, p. 19, 29.
float G_MaskingSmithGGX(float NdotV, float VdotH, float roughness)
float G_MaskingSmithGGX(float NdotV, float roughness)
{
// G1(V, H) = HeavisideStep(VdotH) / (1 + Λ(V)).
// Λ(V) = -0.5 + 0.5 * sqrt(1 + 1 / a²).

// Assume that (VdotH > 0), e.i. (acos(LdotV) < Pi).
float hs = VdotH > 0.0 ? 1.0 : 0.0;
return hs / (0.5 + 0.5 * sqrt(1.0 + a2 * (1.0 / z2 - 1.0)));
return 1 / (0.5 + 0.5 * sqrt(1.0 + a2 * (1.0 / z2 - 1.0)));
float D_GGX_Visible(float NdotH, float NdotV, float VdotH, float roughness)
float D_GGX_Visible(float NdotH, float NdotV, float roughness)
// Note that we pass 1.0 instead of 'VdotH' since the multiplication will already clamp.
return D_GGX(NdotH, roughness) * G_MaskingSmithGGX(NdotV, 1.0, roughness) * VdotH / NdotV;
return D_GGX(NdotH, roughness) * G_MaskingSmithGGX(NdotV, roughness) * VdotH / NdotV;
}
// Ref: http://jcgt.org/published/0003/02/03/paper.pdf

正在加载...
取消
保存