Fix T42888: Separate and Combine HSV distorts the hue value
These nodes were assuming sRGB input/output which is for sure wrong for the shader pipeline which works in the linear space. So now conversion to/from linear space happens in these nodes which makes them making sence in the shader context but which might change look and feel of existing scenes.
This commit is contained in:
parent
137f557246
commit
1549fea999
Notes:
blender-bot
2023-02-14 09:43:44 +01:00
Referenced by commit c5927cd977
, Revert "Fix T42888: Separate and Combine HSV distorts the hue value"
Referenced by issue #42888, Separate and Combine HSV distorts the hue value
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "stdosl.h"
|
||||
#include "node_color.h"
|
||||
|
||||
shader node_combine_hsv(
|
||||
float H = 0.0,
|
||||
|
@ -22,6 +23,6 @@ shader node_combine_hsv(
|
|||
float V = 0.0,
|
||||
output color Color = 0.8)
|
||||
{
|
||||
Color = color("hsv", H, S, V);
|
||||
Color = color_srgb_to_scene_linear(color("hsv", H, S, V));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ shader node_separate_hsv(
|
|||
output float S = 0.0,
|
||||
output float V = 0.0)
|
||||
{
|
||||
color col = rgb_to_hsv(Color);
|
||||
color col = rgb_to_hsv(color_scene_linear_to_srgb(Color));
|
||||
|
||||
H = col[0];
|
||||
S = col[1];
|
||||
|
|
|
@ -26,7 +26,8 @@ ccl_device void svm_node_combine_hsv(KernelGlobals *kg, ShaderData *sd, float *s
|
|||
float value = stack_load_float(stack, value_in);
|
||||
|
||||
/* Combine, and convert back to RGB */
|
||||
float3 color = hsv_to_rgb(make_float3(hue, saturation, value));
|
||||
float3 color = color_srgb_to_scene_linear(
|
||||
hsv_to_rgb(make_float3(hue, saturation, value)));
|
||||
|
||||
if (stack_valid(color_out))
|
||||
stack_store_float3(stack, color_out, color);
|
||||
|
@ -40,7 +41,7 @@ ccl_device void svm_node_separate_hsv(KernelGlobals *kg, ShaderData *sd, float *
|
|||
float3 color = stack_load_float3(stack, color_in);
|
||||
|
||||
/* Convert to HSV */
|
||||
color = rgb_to_hsv(color);
|
||||
color = rgb_to_hsv(color_scene_linear_to_srgb(color));
|
||||
|
||||
if (stack_valid(hue_out))
|
||||
stack_store_float(stack, hue_out, color.x);
|
||||
|
|
Loading…
Reference in New Issue