浏览代码

Make the Van der Corput sequence explicitly one-based

/main
Evgenii Golubev 8 年前
当前提交
840822e7
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 3
      Assets/ScriptableRenderLoop/HDRenderPipeline/SceneSettings/SubsurfaceScatteringParameters.cs
  2. 2
      Assets/ScriptableRenderLoop/ShaderLibrary/Hammersley.hlsl

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


// Ref: http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
static float VanDerCorputBase2(uint i)
{
i = i + 1;
i = (i << 16) | (i >> 16);
i = ((i & 0x00ff00ff) << 8) | ((i & 0xff00ff00) >> 8);
i = ((i & 0x0f0f0f0f) << 4) | ((i & 0xf0f0f0f0) >> 4);

// Importance sample the linear combination of two Gaussians.
for (uint i = 0; i < numSamples; i++)
{
float u = VanDerCorputBase2(i + 1);
float u = VanDerCorputBase2(i);
float pos = GaussianCombinationCdfInverse(u, maxStdDev1, maxStdDev2, m_LerpWeight);
float pdf = GaussianCombination(pos, maxStdDev1, maxStdDev2, m_LerpWeight);

2
Assets/ScriptableRenderLoop/ShaderLibrary/Hammersley.hlsl


float VanDerCorputBase2(uint i)
{
return float(ReverseBits32(i)) * 2.3283064365386963e-10; // 0x100000000
return float(ReverseBits32(i + 1)) * 2.3283064365386963e-10; // 0x100000000
}
float2 Hammersley2dSeq(uint i, uint sequenceLength)

正在加载...
取消
保存