浏览代码

Additional comment

/feature-ReflectionProbeFit
Sebastien Lagarde 7 年前
当前提交
0aa35166
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 7
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/CommonMaterial.hlsl
  2. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

7
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/CommonMaterial.hlsl


// This is a coarse approximation of computing fresnel0 for a different top than air (here clear coat of IOR 1.5) when we only have fresnel0 with air interface
real Fresnel0ReajustFor15(real fresnel0)
{
real sqrtF0 = sqrt(fresnel0);
return Sq(1.0 - 5.0 * sqrtF0) / Sq(5.0 - sqrtF0);
//real sqrtF0 = sqrt(fresnel0);
//return Sq(1.0 - 5.0 * sqrtF0) / Sq(5.0 - sqrtF0);
// Optimization: Fit of the function (3 mad) for range 0.04 (should return 0), 1 (should return 1)
return saturate(-0.0256868 + fresnel0 * (0.326846 + (0.978946 - 0.283835 * fresnel0) * fresnel0));
}
// same as regular refract except there is not the test for total internal reflection + the vector is flipped for processing

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl


// fresnel0 is deduced from interface between air and material (assume to be 1.5 in Unity, or a metal).
// but here we go from clear coat (1.5) to material, we need to update fresnel0
// Note: Schlick is a poor approximation of Fresnel when ieta is 1 (1.5 / 1.5), schlick target 1.4 to 2.2 IOR.
preLightData.baseFresnel0.x = Fresnel0ReajustFor15(bsdfData.fresnel0.x);
preLightData.baseFresnel0.y = Fresnel0ReajustFor15(bsdfData.fresnel0.y);
preLightData.baseFresnel0.z = Fresnel0ReajustFor15(bsdfData.fresnel0.z);

正在加载...
取消
保存