浏览代码

Rename 'param' -> 'params' for consistency

/main
Evgenii Golubev 7 年前
当前提交
c4d118bd
共有 7 个文件被更改,包括 13 次插入13 次删除
  1. 10
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
  5. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.compute
  6. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.shader
  7. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderVariables.hlsl

10
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Camera/HDCamera.cs


public Camera camera;
public uint taaFrameIndex;
public Vector2 taaFrameRotation;
public Vector4 depthBufferParam;
public Vector4 depthBufferParams;
public PostProcessRenderContext postprocessRenderContext;

public bool isFirstFrame { get; private set; }
// Ref: An Efficient Depth Linearization Method for Oblique View Frustums, Eq. 6.
// TODO: pass this as "_DepthBufferParam" if the projection matrix is oblique.
// TODO: pass this as "_DepthBufferParams" if the projection matrix is oblique.
public Vector4 invProjParam
{
get

// http://www.humus.name/temp/Linearize%20depth.txt
if (reverseZ)
{
depthBufferParam = new Vector4(-1 + f/n, 1, -1/f + 1/n, 1/f);
depthBufferParams = new Vector4(-1 + f/n, 1, -1/f + 1/n, 1/f);
depthBufferParam = new Vector4(1 - f/n, f/n, 1/f - 1/n, 1/n);
depthBufferParams = new Vector4(1 - f/n, f/n, 1/f - 1/n, 1/n);
}
frustum = Frustum.Create(viewProjMatrix, depth_0_1, reverseZ);

cmd.SetGlobalFloat( HDShaderIDs._DetViewMatrix, detViewMatrix);
cmd.SetGlobalVector(HDShaderIDs._ScreenSize, screenSize);
cmd.SetGlobalVector(HDShaderIDs._ScreenToTargetScale, scaleBias);
cmd.SetGlobalVector(HDShaderIDs._DepthBufferParam, depthBufferParam);
cmd.SetGlobalVector(HDShaderIDs._DepthBufferParams, depthBufferParams);
cmd.SetGlobalVector(HDShaderIDs._InvProjParam, invProjParam);
cmd.SetGlobalVector(HDShaderIDs._TaaFrameRotation, taaFrameRotation);
cmd.SetGlobalVectorArray(HDShaderIDs._FrustumPlanes, frustumPlaneEquations);

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs


public static readonly int _ViewProjMatrix = Shader.PropertyToID("_ViewProjMatrix");
public static readonly int _InvViewProjMatrix = Shader.PropertyToID("_InvViewProjMatrix");
public static readonly int _DetViewMatrix = Shader.PropertyToID("_DetViewMatrix");
public static readonly int _DepthBufferParam = Shader.PropertyToID("_DepthBufferParam");
public static readonly int _DepthBufferParams = Shader.PropertyToID("_DepthBufferParams");
public static readonly int _InvProjParam = Shader.PropertyToID("_InvProjParam");
public static readonly int _ScreenSize = Shader.PropertyToID("_ScreenSize");
public static readonly int _ScreenToTargetScale = Shader.PropertyToID("_ScreenToTargetScale");

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl


float LoadDepth(float2 positionSS, int level)
{
float pyramidDepth = LOAD_TEXTURE2D_LOD(_DepthPyramidTexture, int2(positionSS.xy) >> level, level).r;
float linearDepth = LinearEyeDepth(pyramidDepth, _DepthBufferParam);
float linearDepth = LinearEyeDepth(pyramidDepth, _DepthBufferParams);
return linearDepth;
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl


float weight = weightNDC.x * weightNDC.y;
float hitDeviceDepth = LOAD_TEXTURE2D_LOD(_DepthPyramidTexture, hit.positionSS, 0).r;
float hitLinearDepth = LinearEyeDepth(hitDeviceDepth, _DepthBufferParam);
float hitLinearDepth = LinearEyeDepth(hitDeviceDepth, _DepthBufferParams);
// Exit if texel is out of color buffer
// Or if the texel is from an object in front of the object

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.compute


float3 irradiance = LOAD_TEXTURE2D(_IrradianceSource, pixelCoord).rgb;
float depth = LOAD_TEXTURE2D(_DepthTexture, pixelCoord).r;
return float4(irradiance, LinearEyeDepth(depth, _DepthBufferParam));
return float4(irradiance, LinearEyeDepth(depth, _DepthBufferParams));
}
// Returns {irradiance, linearDepth}.

UNITY_BRANCH if (passedStencilTest)
{
centerDepth = LOAD_TEXTURE2D(_DepthTexture, pixelCoord).r;
centerViewZ = LinearEyeDepth(centerDepth, _DepthBufferParam);
centerViewZ = LinearEyeDepth(centerDepth, _DepthBufferParams);
}
#if SSS_USE_LDS_CACHE

// Save some bandwidth by only loading depth values for SSS pixels.
UNITY_BRANCH if (TestLightingForSSS(irradiance2))
{
viewZ2 = LinearEyeDepth(LOAD_TEXTURE2D(_DepthTexture, pixelCoord2).r, _DepthBufferParam);
viewZ2 = LinearEyeDepth(LOAD_TEXTURE2D(_DepthTexture, pixelCoord2).r, _DepthBufferParams);
}
// Populate the border region of the LDS cache.

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.shader


// Ref #1: Skin Rendering by Pseudo–Separable Cross Bilateral Filtering.
// Ref #2: Separable SSS, Supplementary Materials, Section E.
float rawDepth = LOAD_TEXTURE2D(_MainDepthTexture, samplePosition).r;
float sampleDepth = LinearEyeDepth(rawDepth, _DepthBufferParam);
float sampleDepth = LinearEyeDepth(rawDepth, _DepthBufferParams);
float zDistance = centimPerUnit * sampleDepth - (centimPerUnit * centerPosVS.z);
sampleWeight *= exp(-zDistance * zDistance * halfRcpVariance);

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderVariables.hlsl


// y = 1
// z = x/far
// w = 1/far
float4 _DepthBufferParam;
float4 _DepthBufferParams;
// TAA Frame Index ranges from 0 to 7. This gives you two rotations per cycle.
float4 _TaaFrameRotation; // { sin(taaFrame * PI/2), cos(taaFrame * PI/2), 0, 0 }

正在加载...
取消
保存