Files
UnrealEngineUWP/Engine/Shaders/Private/Visualization.ush
andrew lauritzen 93dd5946b6 Re-implement debug output visualization for VSM projection
Use actor label for light identification/selection in editor; fall back on component name (UUID) temporarily until this data is made available outside the editor as well
Collect debug data in RayState for SMRT and return the last valid sample data
- Alternative is to always generate debug data based on just a single VSM sample even when SMRT is enabled, but it's useful to have a debug output path for the true SMRT data, even if a bit more complex
Move some common visualization utilities to /Visualization.ush
Implement but disable backface culling for shadow evaluation pending change that handles various SHADINGMODEL's properly

#rb graham.wihlidal, ola.olsson

#ROBOMERGE-SOURCE: CL 16407102 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v804-16311228)

[CL 16412421 by andrew lauritzen in ue5-main branch]
2021-05-20 19:32:20 -04:00

60 lines
1.0 KiB
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ColorMap.ush"
uint MurmurMix(uint Hash)
{
Hash ^= Hash >> 16;
Hash *= 0x85ebca6b;
Hash ^= Hash >> 13;
Hash *= 0xc2b2ae35;
Hash ^= Hash >> 16;
return Hash;
}
float3 IntToColor(uint Index)
{
uint Hash = MurmurMix(Index);
float3 Color = float3
(
(Hash >> 0) & 255,
(Hash >> 8) & 255,
(Hash >> 16) & 255
);
return Color * (1.0f / 255.0f);
}
float3 HUEtoRGB(in float H)
{
float R = abs(H * 6 - 3) - 1;
float G = 2 - abs(H * 6 - 2);
float B = 2 - abs(H * 6 - 4);
return saturate(float3(R, G, B));
}
float3 HSVtoRGB(in float3 HSV)
{
float3 RGB = HUEtoRGB(HSV.x);
return ((RGB - 1) * HSV.y + 1) * HSV.z;
}
float3 GetColorCode(float x)
{
float c = (1 - saturate(x)) * 0.6; // Remap [0,1] to Blue-Red
return x > 0 ? HSVtoRGB(float3(c, 1, 1)) : float3(0, 0, 0);
}
float3 GreenToRedHUE(float s)
{
return HUEtoRGB(lerp(0.333333f, 0.0f, saturate(s)));
}
float3 GreenToRedTurbo(float s)
{
return ColorMapTurbo(lerp(0.5f, 1.0f, saturate(s)));
}