From b377dd05175d5bffaeef9c55051cd396c127daef Mon Sep 17 00:00:00 2001 From: yum Date: Thu, 20 Mar 2025 18:57:24 -0700 Subject: Add false color visualizer Based on Sotalo's Furality talk - I wanted a way to visualize when my albedo is outside the recommended [0.025, 90]% brightness range. This feature does that. Dark is rendered red, bright is rendered blue. --- false_color_visualization.cginc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 false_color_visualization.cginc (limited to 'false_color_visualization.cginc') diff --git a/false_color_visualization.cginc b/false_color_visualization.cginc new file mode 100644 index 0000000..d3508f1 --- /dev/null +++ b/false_color_visualization.cginc @@ -0,0 +1,28 @@ +#ifndef __FALSE_COLOR_VISUALIZATION_INC +#define __FALSE_COLOR_VISUALIZATION_INC + +#include "features.cginc" +#include "globals.cginc" +#include "math.cginc" + +float3 visualizeInFalseColor(float3 color) +{ +#if defined(_FALSE_COLOR_VISUALIZATION) + [branch] + if (_False_Color_Visualization_Luminance) { + color.xyz = luminance(color); + } else if (_False_Color_Visualization_Luminance_Bounded) { + color.xyz = luminance(color); + // Sotalo suggests keeping albedo within the range 0.015% to 90%. He + // might have meant any(color < blah), but I think this makes more + // sense. I.e. it takes into account perceptual bias. + color.xyz = + color.x < 00.015 * 0.01 ? float3(1, 0, 0) : + color.x > 90.000 * 0.01 ? float3(0, 0, 1) : color.xyz; + } +#endif // _FALSE_COLOR_VISUALIZATION +return color; +} + +#endif // __FALSE_COLOR_VISUALIZATION_INC + -- cgit v1.2.3