浏览代码

Implement diffuse GGX

/fptl_cleanup
Evgenii Golubev 8 年前
当前提交
daf47b27
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18
      Assets/ScriptableRenderPipeline/ShaderLibrary/BSDF.hlsl

18
Assets/ScriptableRenderPipeline/ShaderLibrary/BSDF.hlsl


return INV_PI * DisneyDiffuseNoPI(NdotV, NdotL, LdotH, perceptualRoughness);
}
// Ref: Diffuse Lighting for GGX + Smith Microsurfaces, p. 113.
float3 DiffuseGGXNoPI(float3 albedo, float NdotV, float NdotL, float NdotH, float LdotV, float roughness)
{
float facing = 0.5 + 0.5 * LdotV;
float rough = facing * (0.9 - 0.4 * facing) * ((0.5 + NdotH) / NdotH);
float transmitL = 1 - F_Schlick(0, 1, NdotL);
float transmitV = 1 - F_Schlick(0, 1, NdotV);
float smooth = transmitL * transmitV * 1.05; // Normalize F_t over the hemisphere
float single = lerp(smooth, rough, roughness); // Rescaled by PI
float multi = roughness * (0.1159 * PI); // Rescaled by PI
return single + albedo * multi;
}
float3 DiffuseGGX(float3 albedo, float NdotV, float NdotL, float NdotH, float LdotV, float roughness)
{
return INV_PI * DiffuseGGXNoPI(albedo, NdotV, NdotL, NdotH, LdotV, roughness);
}
#endif // UNITY_BSDF_INCLUDED
正在加载...
取消
保存