diff options
| author | yum <yum.food.vr@gmail.com> | 2025-03-20 18:57:24 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-03-20 18:57:24 -0700 |
| commit | b377dd05175d5bffaeef9c55051cd396c127daef (patch) | |
| tree | f868dbd0da08ac1d914e7d6c3fa8a7718bfc83af /false_color_visualization.cginc | |
| parent | ee3db7ea6f80e31e31958848b5138e2a5c848af5 (diff) | |
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.
Diffstat (limited to 'false_color_visualization.cginc')
| -rw-r--r-- | false_color_visualization.cginc | 28 |
1 files changed, 28 insertions, 0 deletions
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
+
|
