Blender V5.3
gpu_shader_material_wavelength.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2021-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9[[node]]
10void node_wavelength(float wavelength, sampler1DArray spectrum_map, float layer, float4 &color)
11{
12 float t = (wavelength - 380.0f) / (780.0f - 380.0f);
13 float3 rgb = texture(spectrum_map, float2(t, layer)).rgb;
14 rgb *= 1.0f / 2.52f; /* Empirical scale from lg to make all comps <= 1. */
15 color = float4(clamp(rgb, 0.0f, 1.0f), 1.0f);
16}
#define layer
constexpr T clamp(T, U, U) RET
SamplerBase< float, 1, false, true > sampler1DArray
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
void node_wavelength(float wavelength, sampler1DArray spectrum_map, float layer, float4 &color)