浏览代码

Limiting mip level when raymarching near screen borders

/main
Frédéric Vauchelles 6 年前
当前提交
c64d8d8a
共有 1 个文件被更改,包括 7 次插入10 次删除
  1. 17
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl

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


)
{
// Blend when the hit is near the thickness of the object
float thicknessWeight = clamp(1 - (hit.linearDepth - minLinearDepth) / settingsDepthBufferThickness, 0, 1);
//float thicknessWeight = clamp(1 - (hit.linearDepth - minLinearDepth) / settingsDepthBufferThickness, 0, 1);
// Blend when the ray when the raymarched distance is too long
float2 screenDistanceNDC = abs(hit.positionSS.xy - startPositionSS) * _ScreenSize.zw;

return thicknessWeight * screenDistanceWeight;
// return thicknessWeight * screenDistanceWeight;
return screenDistanceWeight;
}
#ifdef DEBUG_DISPLAY

}
currentLevel = min(currentLevel + mipLevelDelta, maxMipLevel);
float4 distancesToBorders = float4(positionSS.xy, bufferSize - positionSS.xy);
float distanceToBorders = min(min(distancesToBorders.x, distancesToBorders.y), min(distancesToBorders.z, distancesToBorders.w));
int minLevelForBorders = int(log2(distanceToBorders));
currentLevel = min(currentLevel, minLevelForBorders);
#ifdef DEBUG_DISPLAY
// Fetch post iteration debug values

hit.positionSS = uint2(positionSS.xy);
// Detect when we go behind an object given a thickness
// hitWeight = CalculateHitWeight(
// hit,
// startPositionSS.xy,
// invLinearDepth,
// settingsDepthBufferThickness,
// settingsRayMaxScreenDistance,
// settingsRayBlendScreenDistance
// );
hitWeight = CalculateHitWeight(
hit,

正在加载...
取消
保存