浏览代码

Improve bilateral weighting and alpha blending

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

3
Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderPipeline.cs


// Assume that the height of the projection window is 2 meters.
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", 256.0f * (1.0f - sssParameters.bilateralScale));
m_CombineSubsurfaceScattering.SetFloat("_BilateralScale", 0.05f * 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);

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


ZTest Always
ZWrite Off
Blend One [_DstBlend]
Blend One [_DstBlend], Zero [_DstBlend]
HLSLPROGRAM
#pragma target 4.5

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

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


parameters.profiles[i] = SubsurfaceScatteringProfile.Default;
}
parameters.bilateralScale = 0.0f;
parameters.bilateralScale = 0.1f;
return parameters;
}
}
正在加载...
取消
保存