浏览代码

Use proper coordinates when sampling color pyramid

Added a pixel offset when returning hit result from HiZ
/main
Frédéric Vauchelles 6 年前
当前提交
58fc6522
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl
  2. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

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


}
hit.linearDepth = positionLinearDepth;
hit.positionNDC = float2(positionSS.xy) / float2(bufferSize);
// Move one pixel in the ray direction
// This is where the ray actually hit
hit.positionSS += int2(raySS.xy * abs(invRaySS));
hit.positionNDC = float2(hit.positionSS) / float2(bufferSize);
// Detect when we go behind an object given a thickness

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


UpdateLightingHierarchyWeights(hierarchyWeight, weight); // Shouldn't be needed, but safer in case we decide to change hierarchy priority
// Reproject color pyramid
float4 velocityBuffer = SAMPLE_TEXTURE2D_LOD(
float4 velocityBuffer = LOAD_TEXTURE2D_LOD(
s_linear_clamp_sampler,
hit.positionNDC * _CameraMotionVectorsScale.xy,
hit.positionSS,
0.0
);

float3 preLD = SAMPLE_TEXTURE2D_LOD(
_ColorPyramidTexture,
s_trilinear_clamp_sampler,
(hit.positionNDC - velocityNDC) * _ColorPyramidScale.xy,
// Offset by half a texel to properly interpolate between this pixel and its mips
(hit.positionNDC - velocityNDC) * _ColorPyramidScale.xy + _ColorPyramidSize.zw * 0.5,
mipLevel
).rgb;

正在加载...
取消
保存