Blender V4.3
wavelength.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2010 Sony Pictures Imageworks Inc., et al. All Rights Reserved.
2 * SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * Adapted code from Open Shading Language. */
7
8#pragma once
9
11
13
14/* Wavelength to RGB */
15
18 ccl_private float *stack,
19 uint wavelength,
20 uint color_out)
21{
22 const float lambda_nm = stack_load_float(stack, wavelength);
23
25 color = xyz_to_rgb(kg, color);
26 color *= 1.0f / 2.52f; // Empirical scale from lg to make all comps <= 1
27
28 /* Clamp to zero if values are smaller */
29 color = max(color, make_float3(0.0f, 0.0f, 0.0f));
30
31 stack_store_float3(stack, color_out, color);
32}
33
unsigned int uint
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
const KernelGlobalsCPU *ccl_restrict KernelGlobals
#define ccl_private
#define ccl_device_noinline
#define CCL_NAMESPACE_END
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
ccl_device_inline void stack_store_float3(ccl_private float *stack, uint a, float3 f)
ccl_device_inline float stack_load_float(ccl_private float *stack, uint a)
ShaderData
ccl_device float3 svm_math_wavelength_color_xyz(float lambda_nm)
Definition math_util.h:244
color xyz_to_rgb(float x, float y, float z)
Definition node_color.h:73
float max
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_wavelength(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, uint wavelength, uint color_out)
Definition wavelength.h:16