Blender
V5.3
source
blender
gpu
shaders
common
gpu_shader_debug_gradients.bsl.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include "
gpu_shader_compat.hh
"
8
9
/*
10
* For debugging purpose mainly.
11
* From https://www.shadertoy.com/view/4dsSzr
12
* By Morgan McGuire @morgan3d, http://graphicscodex.com
13
* Reuse permitted under the BSD license.
14
*/
15
float3
neon_gradient
(
float
t)
16
{
17
float
tt =
abs
(0.43f - t) * 1.7f;
18
return
clamp
(
float3
(t * 1.3f + 0.1f, tt * tt, (1.0f - t) * 1.7f), 0.0f, 1.0f);
19
}
20
float3
heatmap_gradient
(
float
t)
21
{
22
float
a =
pow
(t, 1.5f) * 0.8f + 0.2f;
23
float
b
=
smoothstep
(0.0f, 0.35f, t) + t * 0.5f;
24
float
c =
smoothstep
(0.5f, 1.0f, t);
25
float
d =
max
(1.0f - t * 1.7f, t * 7.0f - 6.0f);
26
return
clamp
(a *
float3
(
b
, c, d),
float3
(0.0f),
float3
(1.0f));
27
}
28
float3
hue_gradient
(
float
t)
29
{
30
float3
p =
abs
(
fract
(t +
float3
(1.0f, 2.0f / 3.0f, 1.0f / 3.0f)) * 6.0f - 3.0f);
31
return
(
clamp
(p - 1.0f, 0.0f, 1.0f));
32
}
33
float3
green_to_red_gradient
(
float
t)
34
{
35
return
mix
(
float3
(0.0f, 1.0f, 0.0f),
float3
(1.0f, 0.0f, 0.0f), t);
36
}
max
btScalar max
Definition
btHeightfieldTerrainShape.h:79
b
b
Definition
compositor_morphological_distance_infos.hh:36
gpu_shader_compat.hh
smoothstep
T smoothstep(T, T, T) RET
fract
T fract(T) RET
pow
#define pow
Definition
gpu_shader_cxx_builtin.hh:116
abs
#define abs
Definition
gpu_shader_cxx_builtin.hh:104
clamp
constexpr T clamp(T, U, U) RET
hue_gradient
float3 hue_gradient(float t)
Definition
gpu_shader_debug_gradients.bsl.hh:28
heatmap_gradient
float3 heatmap_gradient(float t)
Definition
gpu_shader_debug_gradients.bsl.hh:20
green_to_red_gradient
float3 green_to_red_gradient(float t)
Definition
gpu_shader_debug_gradients.bsl.hh:33
neon_gradient
float3 neon_gradient(float t)
Definition
gpu_shader_debug_gradients.bsl.hh:15
mix
#define mix
Definition
radial_tiling_shared.hh:83
float3
Definition
sky_math.h:135
Generated on
for Blender by
doxygen
1.18.0