Files
test/intern/cycles/kernel/svm/blackbody.h
Brecht Van Lommel a22ad7fbd3 Fix T98036: Cycles blackbody inaccurate for low temperature and wide gamut
Regenerate blackbody RGB curve fit to not clamp values, and extend down to
800K since it does now change below 965K.

Note that as before, blackbody is only defined in the range 800K to 12000K
and has a fixed value outside of that. But within that range there should
be no more unnecessary gamut clamping.
2022-05-23 22:07:59 +02:00

33 lines
950 B
C

/* SPDX-License-Identifier: BSD-3-Clause
*
* Adapted from Open Shading Language
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
* All Rights Reserved.
*
* Modifications Copyright 2011-2022 Blender Foundation. */
#pragma once
#include "kernel/svm/math_util.h"
CCL_NAMESPACE_BEGIN
/* Blackbody Node */
ccl_device_noinline void svm_node_blackbody(KernelGlobals kg,
ccl_private ShaderData *sd,
ccl_private float *stack,
uint temperature_offset,
uint col_offset)
{
/* Input */
float temperature = stack_load_float(stack, temperature_offset);
float3 color_rgb = rec709_to_rgb(kg, svm_math_blackbody_color_rec709(temperature));
color_rgb = max(color_rgb, zero_float3());
stack_store_float3(stack, col_offset, color_rgb);
}
CCL_NAMESPACE_END