浏览代码

Implement an improved version of GetSpecularDominantDir()

/main
Evgenii Golubev 8 年前
当前提交
a55223d2
共有 1 个文件被更改,包括 13 次插入5 次删除
  1. 18
      Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl

18
Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl


return saturate(1.7 / 1.4 - sqrt(2.89 - 2.8 * perceptualRoughness) / 1.4);
}
// Ref: See "Moving Frostbite to PBR" Listing 22
// This formulation is for GGX only (with smith joint visibility or regular)
// Ref: "Moving Frostbite to PBR", p. 69.
float a = 1.0 - roughness;
// TODO: we could bias this further (and use 'NdotV') to better match the reference.
float lerpFactor = a * (sqrt(a) + roughness);
float a = 1.0 - roughness;
float s = sqrt(1.0 - roughness);
float sinNV = sqrt(1.0 - NdotV * NdotV);
#ifdef USE_FB_DSD
// This is the original formulation.
float lerpFactor = a * (s + roughness);
#else
// TODO: tweak this further to achieve a closer match to the reference.
float lerpFactor = s * saturate(lerp(s + s, a * a, sinNV));
#endif
// The result is not normalized as we fetch in a cubemap
return lerp(N, R, lerpFactor);
}

正在加载...
取消
保存