浏览代码

(wip) added debug for screen space tracing

/feature-ScreenSpaceProjection
Frédéric Vauchelles 7 年前
当前提交
56d74148
共有 3 个文件被更改,包括 34 次插入6 次删除
  1. 22
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/ScreenSpaceRaymarching.hlsl
  2. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs
  3. 10
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs.hlsl

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


bool hitSuccessful = true;
#ifdef DEBUG_DISPLAY
int maxUsedLevel = currentLevel;
#endif
while (currentLevel >= minLevel)
{
if (++iteration < MAX_ITERATIONS)

if (hiZLinearDepth > testHitPositionTXS.z)
{
currentLevel = min(maxLevel, currentLevel + 1);
#ifdef DEBUG_DISPLAY
maxUsedLevel = max(maxUsedLevel, currentLevel);
#endif
positionTXS = testHitPositionTXS;
hit.distance += rayOffsetTestLength;
}

positionTXS += dirNDC * rayOffsetLength;
hit.distance += rayOffsetLength;
--currentLevel;
}
}

{
switch (_DebugLightingSubMode)
{
case DEBUGSCREENSPACETRACING_POSITION_VS:
case DEBUGSCREENSPACETRACING_POSITION_NDC:
case DEBUGSCREENSPACETRACING_DIR_NDC:
hit.debugOutput = dirNDC;
break;
break;
case DEBUGSCREENSPACETRACING_HIT_SUCCESS:
hit.debugOutput = hitSuccessful;
break;
case DEBUGSCREENSPACETRACING_ITERATION_COUNT:
hit.debugOutput = float(iteration) / float(MAX_ITERATIONS);
break;
case DEBUGSCREENSPACETRACING_MAX_USED_LEVEL:
hit.debugOutput = float(maxUsedLevel) / float(maxLevel);
break;
}
}

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs


public enum DebugScreenSpaceTracing
{
None,
PositionVS,
PositionNDC,
DirNDC,
HitDepth
HitDepth,
HitSuccess,
IterationCount,
MaxUsedLevel
}
public enum ShadowMapDebugMode

10
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs.hlsl


// UnityEngine.Experimental.Rendering.HDPipeline.DebugScreenSpaceTracing: static fields
//
#define DEBUGSCREENSPACETRACING_NONE (0)
#define DEBUGSCREENSPACETRACING_POSITION_VS (1)
#define DEBUGSCREENSPACETRACING_HIT_DISTANCE (2)
#define DEBUGSCREENSPACETRACING_HIT_DEPTH (3)
#define DEBUGSCREENSPACETRACING_POSITION_NDC (1)
#define DEBUGSCREENSPACETRACING_DIR_NDC (2)
#define DEBUGSCREENSPACETRACING_HIT_DISTANCE (3)
#define DEBUGSCREENSPACETRACING_HIT_DEPTH (4)
#define DEBUGSCREENSPACETRACING_HIT_SUCCESS (5)
#define DEBUGSCREENSPACETRACING_ITERATION_COUNT (6)
#define DEBUGSCREENSPACETRACING_MAX_USED_LEVEL (7)
#endif
正在加载...
取消
保存