浏览代码

Use the anisotropy parametrization of Sony Imageworks

/stochastic_alpha_test
Evgenii Golubev 7 年前
当前提交
8d9edb9e
共有 1 个文件被更改,包括 4 次插入8 次删除
  1. 12
      ScriptableRenderPipeline/Core/ShaderLibrary/CommonMaterial.hlsl

12
ScriptableRenderPipeline/Core/ShaderLibrary/CommonMaterial.hlsl


// Convert anisotropic ratio (0->no isotropic; 1->full anisotropy in tangent direction) to roughness
void ConvertAnisotropyToRoughness(float roughness, float anisotropy, out float roughnessT, out float roughnessB)
{
// (0 <= abs(anisotropy) <= 1), therefore (0 <= anisoAspect <= 1)
// The 0.9 factor limits the aspect ratio to 10:1.
float anisoAspect = 1.0 - 0.9 * abs(anisotropy);
float anisoT = (anisotropy >= 0) ? rsqrt(anisoAspect) : sqrt(anisoAspect);
float anisoB = (anisotropy >= 0) ? sqrt(anisoAspect) : rsqrt(anisoAspect);
roughnessT = roughness * anisoT; // For positive anisotropy: distort along tangent (rougher)
roughnessB = roughness * anisoB; // For positive anisotropy: straighten along bitangent (smoother)
// Use the parametrization of Sony Imageworks.
// Ref: Revisiting Physically Based Shading at Imageworks, p. 15.
roughnessT = roughness * (1 + anisotropy);
roughnessB = roughness * (1 - anisotropy);
}
// Ref: Donald Revie - Implementing Fur Using Deferred Shading (GPU Pro 2)

正在加载...
取消
保存