Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ public static class ShadowCascadeGUI
private const float kSliderbarMargin = 2.0f;
private const float kSliderbarHeight = 28.0f;

// Keep in sync with the ones in Debug.hlsl
private static readonly Color[] kCascadeColors =
{
new Color(0.5f, 0.5f, 0.7f, 1.0f),
new Color(0.5f, 7, 0.5f, 1.0f),
new Color(0.5f, 0.7f, 0.5f, 1.0f),
new Color(0.7f, 0.7f, 0.5f, 1.0f),
new Color(0.7f, 0.5f, 0.5f, 1.0f),
};
Expand Down
7 changes: 7 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/Debug.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
#define kDebugColorBrightRed float4(255.0 / 255.0, 67.0 / 255.0, 51.0 / 255.0, 1.0) // #FF4333
#define kDebugColorDarkRed float4(132.0 / 255.0, 10.0 / 255.0, 54.0 / 255.0, 1.0) // #840A36

// Shadow cascade debug colors. Keep in sync with the ones in ShadowCascadeGUI.cs.
// Note: These colors are not 1:1 match to editor UI, in order to provide better contrast in the viewport.
#define kDebugColorShadowCascade0 float4(0.4, 0.4, 0.9, 1.0)
#define kDebugColorShadowCascade1 float4(0.4, 0.9, 0.4, 1.0)
#define kDebugColorShadowCascade2 float4(0.9, 0.9, 0.4, 1.0)
#define kDebugColorShadowCascade3 float4(0.9, 0.4, 0.4, 1.0)

// UX-verified colorblind-optimized "heat color gradient"
static const float4 kDebugColorGradient[DEBUG_COLORS_COUNT] = { kDebugColorBlack, kDebugColorLightPurple, kDebugColorDeepBlue,
kDebugColorSkyBlue, kDebugColorLightBlue, kDebugColorTeal, kDebugColorBrightGreen, kDebugColorBrightYellow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ void ApplyDebug(LightLoopContext context, PositionInputs posInput, BSDFData bsdf
lightLoopOutput.specularLighting = float3(0.0, 0.0, 0.0);

const float3 s_CascadeColors[] = {
float3(0.5, 0.5, 0.7),
float3(0.5, 0.7, 0.5),
float3(0.7, 0.7, 0.5),
float3(0.7, 0.5, 0.5),
kDebugColorShadowCascade0.rgb,
kDebugColorShadowCascade1.rgb,
kDebugColorShadowCascade2.rgb,
kDebugColorShadowCascade3.rgb,
float3(1.0, 1.0, 1.0)
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,13 @@ half3 CalculateDebugShadowCascadeColor(in InputData inputData)
{
float3 positionWS = inputData.positionWS;
half cascadeIndex = ComputeCascadeIndex(positionWS);

switch (uint(cascadeIndex))
{
case 0: return kDebugColorBrightRed.rgb;
case 1: return kDebugColorDarkYellow.rgb;
case 2: return kDebugColorSkyBlue.rgb;
case 3: return kDebugColorBrightGreen.rgb;
case 0: return kDebugColorShadowCascade0.rgb;
case 1: return kDebugColorShadowCascade1.rgb;
case 2: return kDebugColorShadowCascade2.rgb;
case 3: return kDebugColorShadowCascade3.rgb;
default: return kDebugColorBlack.rgb;
}
}
Expand Down