浏览代码

Improve bilateral weighting

/main
Evgenii Golubev 8 年前
当前提交
e4af7f76
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderPipeline.cs
  2. 4
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader

2
Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderPipeline.cs


float distanceToProjectionWindow = 1.0f / Mathf.Tan(0.5f * Mathf.Deg2Rad * hdCamera.camera.fieldOfView);
m_CombineSubsurfaceScattering.SetFloat("_DistToProjWindow", distanceToProjectionWindow);
// Note: the user-provided bilateral scale is reversed (compared to the one in the shader).
m_CombineSubsurfaceScattering.SetFloat("_BilateralScale", 4.0f * (1.0f - sssParameters.bilateralScale));
m_CombineSubsurfaceScattering.SetFloat("_BilateralScale", 256.0f * (1.0f - sssParameters.bilateralScale));
// TODO: use user-defined values for '_ProfileID' and '_FilterRadius.'
m_CombineSubsurfaceScattering.SetVectorArray("_FilterKernel", sssParameters.profiles[0].filterKernel);
m_CombineSubsurfaceScattering.SetFloat("_FilterRadius", 5.0f);

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


// Apply bilateral filtering.
float sDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
float dDepth = abs(sDepth - cDepth);
float dScale = _FilterRadius * _DistToProjWindow * _BilateralScale;
float dScale = _BilateralScale / (_FilterRadius * _DistToProjWindow);
float t = saturate(dScale * dDepth);
// TODO: use real-world distances for weighting.

return float4(false ? cIrradiance : filteredIrradiance, 1.0);
return float4(filteredIrradiance, 1.0);
}
ENDHLSL
}

正在加载...
取消
保存