Blender V5.3
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
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 */
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}
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}
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}
34{
35 return mix(float3(0.0f, 1.0f, 0.0f), float3(1.0f, 0.0f, 0.0f), t);
36}
btScalar max
T smoothstep(T, T, T) RET
T fract(T) RET
#define pow
#define abs
constexpr T clamp(T, U, U) RET
float3 hue_gradient(float t)
float3 heatmap_gradient(float t)
float3 green_to_red_gradient(float t)
float3 neon_gradient(float t)
#define mix