浏览代码

Increase the contribution of SSS samples

/Branch_Batching2
Evgenii Golubev 8 年前
当前提交
3dde4852
共有 1 个文件被更改,包括 13 次插入5 次删除
  1. 18
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs

18
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs


Vector3 weightSum = new Vector3(0, 0, 0);
float rcpNumSamples = 1.0f / numSamples;
int numSamplesPlus2 = numSamples + 2;
float step = 1.0f / (numSamplesPlus2 - 1);
for (uint i = 0; i < numSamples; i++)
for (int i = 0, s = 0; s < numSamplesPlus2; s++)
float u = (i <= numSamples / 2) ? 0.5f - i * rcpNumSamples // The center and to the left
: (i + 0.5f) * rcpNumSamples; // From the center to the right
// Skip the leftmost and the rightmost samples due to the low weight.
if (s == numSamplesPlus2 / 2 || s == numSamplesPlus2 - 1) continue;
// Generate 'u' on (0, 0.5] and (0.5, 1).
float u = (s < numSamplesPlus2 / 2) ? 0.5f - s * step // The center and to the left
: s * step; // From the center to the right
float pos = GaussianCombinationCdfInverse(u, maxStdDev1, maxStdDev2, lerpWeight);
float pdf = GaussianCombination(pos, maxStdDev1, maxStdDev2, lerpWeight);

weightSum.x += m_FilterKernel[i].x;
weightSum.y += m_FilterKernel[i].y;
weightSum.z += m_FilterKernel[i].z;
i++;
for (uint i = 0; i < numSamples; i++)
for (int i = 0; i < numSamples; i++)
{
m_FilterKernel[i].x *= 1 / weightSum.x;
m_FilterKernel[i].y *= 1 / weightSum.y;

正在加载...
取消
保存