浏览代码

Implement the correct approximated version of mipmapLevelToPerceptualRoughness()

/main
Evgenii Golubev 8 年前
当前提交
49f1ca22
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 15
      Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl

15
Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl


// Util image based lighting
//-----------------------------------------------------------------------------
// Performs a *non-linear* remapping which improves the perceptual roughness distribution
// and adds reflection (contact) hardening. The *approximated* version.
// The *approximated* version of the non-linear remapping which improves
// the perceptual roughness distribution and adds reflection (contact) hardening.
float perceptualRoughnessToMipmapLevel(float perceptualRoughness)
{
perceptualRoughness = perceptualRoughness * (1.7 - 0.7 * perceptualRoughness);

// Performs a *non-linear* remapping which improves the perceptual roughness distribution
// and adds reflection (contact) hardening. The *accurate* version.
// The *accurate* version of the non-linear remapping which improves
// the perceptual roughness distribution and adds reflection (contact) hardening.
// TODO: optimize!
float perceptualRoughnessToMipmapLevel(float perceptualRoughness, float NdotR)
{

return perceptualRoughness * UNITY_SPECCUBE_LOD_STEPS;
}
// Performs *linear* remapping for runtime EnvMap filtering.
// The *approximated* version of the non-linear remapping which improves
// the perceptual roughness distribution and adds reflection (contact) hardening.
return saturate(mipmapLevel / UNITY_SPECCUBE_LOD_STEPS);
float perceptualRoughness = saturate(mipmapLevel / UNITY_SPECCUBE_LOD_STEPS);
return saturate(1.7 / 1.4 - sqrt(2.89 - 2.8 * perceptualRoughness) / 1.4);
}
// Ref: See "Moving Frostbite to PBR" Listing 22

正在加载...
取消
保存