浏览代码

Accurately sample the combination of two Gaussians

/main
Evgenii Golubev 8 年前
当前提交
8aa3f256
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 13
      Assets/ScriptableRenderLoop/HDRenderPipeline/SceneSettings/SubsurfaceScatteringParameters.cs

13
Assets/ScriptableRenderLoop/HDRenderPipeline/SceneSettings/SubsurfaceScatteringParameters.cs


return x * stdDev;
}
static float GaussianCombinationCdfInverse(float p, float stdDev1, float stdDev2, float lerpWeight)
{
return Mathf.Lerp(NormalCdfInverse(p, stdDev1), NormalCdfInverse(p, stdDev2), lerpWeight);
}
// Ref: https://en.wikipedia.org/wiki/Halton_sequence
static float VanDerCorput(uint b, uint i)
{

float maxStdDev1 = Mathf.Max(m_StdDev1.r, m_StdDev1.g, m_StdDev1.b);
float maxStdDev2 = Mathf.Max(m_StdDev2.r, m_StdDev2.g, m_StdDev2.b);
// Importance sample two Gaussians based on the interpolation weight.
float sd = Mathf.Lerp(maxStdDev1, maxStdDev2, m_LerpWeight);
// Importance sample the linear combination of two Gaussians.
float pos = NormalCdfInverse(u, sd);
float pdf = Gaussian(pos, sd);
float pos = GaussianCombinationCdfInverse(u, maxStdDev1, maxStdDev2, m_LerpWeight);
float pdf = GaussianCombination(pos, maxStdDev1, maxStdDev2, m_LerpWeight);
Vector3 val;
val.x = GaussianCombination(pos, m_StdDev1.r, m_StdDev2.r, m_LerpWeight);

正在加载...
取消
保存