浏览代码

Implement faster (achromatic) bilateral weighting

/main
Evgenii Golubev 8 年前
当前提交
0d77adff
共有 2 个文件被更改,包括 10 次插入5 次删除
  1. 9
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader
  2. 6
      Assets/ScriptableRenderLoop/HDRenderPipeline/SceneSettings/SubsurfaceScatteringParameters.cs

9
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader


#endif
float2 scaledDirection = distScale * stepSize * unitDirection;
// Load (1 / (2 * WeightedVariance)) for bilateral weighting.
// Load (1 / (2 * Variance)) for bilateral weighting.
#ifdef RBG_BILATERAL_WEIGHTS
#else
float halfRcpVariance = _FilterKernels[profileID][N_SAMPLES].a;
#endif
// Take the first (central) sample.
float2 samplePosition = posInput.unPositionSS;
float3 sampleWeight = _FilterKernels[profileID][0].rgb;

rawDepth = LOAD_TEXTURE2D(_CameraDepthTexture, samplePosition).r;
sampleIrradiance = LOAD_TEXTURE2D(_IrradianceSource, samplePosition).rgb;
// Apply bilateral filtering.
// Apply bilateral weighting.
// Ref #1: Skin Rendering by Pseudo–Separable Cross Bilateral Filtering.
// Ref #2: Separable SSS, Supplementary Materials, Section E.
float sampleDepth = LinearEyeDepth(rawDepth, _ZBufferParams);

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


m_FilterKernel[i].z *= 1 / weightSum.z;
}
Vector3 weightedStdDev;
Vector4 weightedStdDev;
weightedStdDev.w = Mathf.Lerp(maxStdDev1, maxStdDev2, m_LerpWeight);
// Store (1 / (2 * WeightedVariance)) per color channel.
// Store (1 / (2 * Variance)) per color channel.
m_FilterKernel[numSamples].w = 0.5f / (weightedStdDev.w * weightedStdDev.w);
}
}

正在加载...
取消
保存