浏览代码

Rename '_FilterWidth' to '_FilterRadius'

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

2
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);
m_CombineSubsurfaceScattering.SetFloat("_FilterWidth", 20.0f);
m_CombineSubsurfaceScattering.SetFloat("_FilterRadius", 20.0f);
m_CombineSubsurfaceScattering.SetFloat("_BilateralScale", 0.1f);
MaterialPropertyBlock properties = new MaterialPropertyBlock();

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


{
Properties
{
_FilterWidth("", Float) = 20
_FilterRadius("", Float) = 20
_BilateralScale("", Float) = 0.1
[HideInInspector] _DstBlend("", Float) = 1 // Can be set to 1 for blending with specular
}

// Inputs & outputs
//-------------------------------------------------------------------------------------
float _FilterWidth; // Uses world-space units
float _FilterRadius; // Uses world-space units
float _FilterHorizontal; // Vertical = 0, horizontal = 1
float _FilterHorizontal; // Vertical = 0, horizontal = 1
float _DistToProjWindow; // The height of the projection window is 2 meters
TEXTURE2D(_CameraDepthTexture);

{
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw);
float rawDepth = LOAD_TEXTURE2D(_CameraDepthTexture, posInput.unPositionSS).r;
float cDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
float widthScale = _FilterWidth * _DistToProjWindow / cDepth;
float rawDepth = LOAD_TEXTURE2D(_CameraDepthTexture, posInput.unPositionSS).r;
float cDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
float radiusScale = _FilterRadius * _DistToProjWindow / cDepth;
float2 scaledDirection = widthScale * unitDirection;
float2 scaledDirection = radiusScale * unitDirection;
// Premultiply with the inverse of the screen size.
scaledDirection *= _ScreenSize.zw;

// Apply bilateral filtering.
float sDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
float dDepth = abs(sDepth - cDepth);
float dScale = _FilterWidth * _DistToProjWindow * _BilateralScale;
float dScale = _FilterRadius * _DistToProjWindow * _BilateralScale;
float t = saturate(dScale * dDepth);
filteredIrradiance += lerp(sIrradiance, cIrradiance, t) * sWeight;

正在加载...
取消
保存