浏览代码

[ScreenSpaceTracing] (wip) step by step debugging

[ScreenSpaceTracing] (wip) step by step debugging
/feature-ScreenSpaceProjection
Frédéric Vauchelles 7 年前
当前提交
ea404593
共有 2 个文件被更改,包括 12 次插入3 次删除
  1. 14
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/ScreenSpaceRaymarching.hlsl
  2. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

14
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/ScreenSpaceRaymarching.hlsl


#ifdef DEBUG_DISPLAY
int maxUsedLevel = currentLevel;
uint2 debugCellSize = cellSize;
float3 debugPositionTXS = positionTXS;
#endif
while (currentLevel >= input.minLevel)

if (_DebugStep == iteration)
{
debugCellSize = cellSize;
debugPositionTXS = positionTXS;
}
#endif

float2 distanceToCell = abs(float2(input.initialStartPositionSS % debugCellSize) - float2(debugCellSize) / float2(2, 2));
distanceToCell = clamp(1 - distanceToCell, 0, 1);
float cellSDF = max(distanceToCell.x, distanceToCell.y);
float3 gridColor = float3(
frac(input.initialStartLinearDepth * 0.1).xx,
float distanceToPosition = length(input.initialStartPositionSS - debugPositionTXS.xy);
float positionSDF = clamp(3 - distanceToPosition, 0, 1);
float3 debugColor = float3(
0,
positionSDF,
hit.debugOutput = gridColor;
hit.debugOutput = debugColor * 0.5 + frac(input.initialStartLinearDepth * 0.1).xxx * 0.5;
break;
}
}

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


#ifdef DEBUG_DISPLAY
ssInput.initialStartPositionSS = initialPositionInputs.positionSS;
ssInput.initialStartLinearDepth = initialPositionInputs.linearDepth;
#endif
bool hitSuccessful = ScreenSpaceRaymarch(ssInput, hit);

正在加载...
取消
保存