浏览代码

Added debug for sampled color in raymarching

/main
Frédéric Vauchelles 7 年前
当前提交
842b295a
共有 4 个文件被更改,包括 41 次插入11 次删除
  1. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs
  2. 10
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs.hlsl
  3. 18
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl
  4. 20
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

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


HiZMaxUsedMipLevel,
HiZIntersectionKind,
HiZHitWeight,
HiZSampledColor,
LinearHitWeight
LinearHitWeight,
LinearSampledColor
}
public enum ShadowMapDebugMode

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


#define DEBUGSCREENSPACETRACING_HI_ZMAX_USED_MIP_LEVEL (9)
#define DEBUGSCREENSPACETRACING_HI_ZINTERSECTION_KIND (10)
#define DEBUGSCREENSPACETRACING_HI_ZHIT_WEIGHT (11)
#define DEBUGSCREENSPACETRACING_LINEAR_POSITION_NDC (12)
#define DEBUGSCREENSPACETRACING_LINEAR_RAY_DIR_NDC (13)
#define DEBUGSCREENSPACETRACING_LINEAR_ITERATION_COUNT (14)
#define DEBUGSCREENSPACETRACING_LINEAR_HIT_WEIGHT (15)
#define DEBUGSCREENSPACETRACING_HI_ZSAMPLED_COLOR (12)
#define DEBUGSCREENSPACETRACING_LINEAR_POSITION_NDC (13)
#define DEBUGSCREENSPACETRACING_LINEAR_RAY_DIR_NDC (14)
#define DEBUGSCREENSPACETRACING_LINEAR_ITERATION_COUNT (15)
#define DEBUGSCREENSPACETRACING_LINEAR_HIT_WEIGHT (16)
#define DEBUGSCREENSPACETRACING_LINEAR_SAMPLED_COLOR (17)
#endif

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


)
{
float3 positionWS = rayOriginWS;
float3 rayEndWS = rayOriginWS + rayDirWS * 10;
float3 rayEndWS = rayOriginWS + rayDirWS * 1;
float4 positionCS = ComputeClipSpacePosition(positionWS, GetWorldToHClipMatrix());
float4 rayEndCS = ComputeClipSpacePosition(rayEndWS, GetWorldToHClipMatrix());

float3 positionSS = startPositionSS;
raySS /= max(abs(raySS.x), abs(raySS.y));
raySS *= 1 << mipLevel;
// Offset by a texel
//positionSS += raySS * 1.0;
#ifdef DEBUG_DISPLAY
float3 debugIterationPositionSS = positionSS;

float minLinearDepth = 0;
float minLinearDepthWithThickness = 0;
positionSS = IntersectCellPlanes(
positionSS,
raySS,
invRaySS,
int2(positionSS.xy) / cellSize,
cellSize,
cellPlanes,
crossOffset
);
while (currentLevel >= minMipLevel)
{
hitSuccessful = true;

cellId,
cellSize,
cellPlanes,
crossOffset);
crossOffset
);
intersectionKind = HIZINTERSECTIONKIND_CELL;

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


// Debug screen space tracing
#ifdef DEBUG_DISPLAY
if (_DebugLightingMode == debugMode
&& _DebugLightingSubMode != DEBUGSCREENSPACETRACING_COLOR)
&& _DebugLightingSubMode != DEBUGSCREENSPACETRACING_COLOR
&& _DebugLightingSubMode != DEBUGSCREENSPACETRACING_LINEAR_SAMPLED_COLOR
&& _DebugLightingSubMode != DEBUGSCREENSPACETRACING_HI_ZSAMPLED_COLOR
)
{
float weight = 1.0;
UpdateLightingHierarchyWeights(hierarchyWeight, weight);

lighting.specularTransmitted = (1.0 - F) * preLD.rgb * preLightData.transparentTransmittance * weight;
else if (GPUImageBasedLightingType == GPUIMAGEBASEDLIGHTINGTYPE_REFLECTION)
lighting.specularReflected = F * preLD.rgb * weight;
#ifdef DEBUG_DISPLAY
if (_DebugLightingMode == debugMode
&& (_DebugLightingSubMode == DEBUGSCREENSPACETRACING_LINEAR_SAMPLED_COLOR
|| _DebugLightingSubMode == DEBUGSCREENSPACETRACING_HI_ZSAMPLED_COLOR))
{
float weight = 1.0;
UpdateLightingHierarchyWeights(hierarchyWeight, weight);
if (GPUImageBasedLightingType == GPUIMAGEBASEDLIGHTINGTYPE_REFRACTION)
lighting.specularTransmitted = preLD.rgb;
else if (GPUImageBasedLightingType == GPUIMAGEBASEDLIGHTINGTYPE_REFLECTION)
lighting.specularReflected = preLD.rgb;
return lighting;
}
#endif
return lighting;
}

正在加载...
取消
保存