Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Herholz <sherholz>2022-04-28 19:00:41 +0300
committerSergey Sharybin <sergey@blender.org>2022-04-28 19:14:06 +0300
commitbd327e3bf3e0768aa2768949304571e0eb73ab80 (patch)
tree7772168bd934fc648a663accffa06542c172b411 /intern/cycles/kernel/util
parent110eb2300526519681b44e154473b5fd087d191e (diff)
Fix: Sky models can return negative values
When converting from XYZ to RGB it can happen, in some sky models, that the resulting RGB values are negative. Atm, this is not considered and the returned values for the sky model can be negative. This patch clamps the returned RGB values to be `= 0.f` Reviewed By: brecht, sergey Differential Revision: https://developer.blender.org/D14777
Diffstat (limited to 'intern/cycles/kernel/util')
-rw-r--r--intern/cycles/kernel/util/color.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/intern/cycles/kernel/util/color.h b/intern/cycles/kernel/util/color.h
index 28978d873d6..c85ef262d88 100644
--- a/intern/cycles/kernel/util/color.h
+++ b/intern/cycles/kernel/util/color.h
@@ -14,6 +14,11 @@ ccl_device float3 xyz_to_rgb(KernelGlobals kg, float3 xyz)
dot(float4_to_float3(kernel_data.film.xyz_to_b), xyz));
}
+ccl_device float3 xyz_to_rgb_clamped(KernelGlobals kg, float3 xyz)
+{
+ return max(xyz_to_rgb(kg, xyz), zero_float3());
+}
+
ccl_device float3 rec709_to_rgb(KernelGlobals kg, float3 rec709)
{
return (kernel_data.film.is_rec709) ?