Fix #107583: HSV node gives differ from CPU compositor

The HSV node in the realtime compositor produces different values from
the CPU compositor in its identity settings.

This happens because the realtime compositor clamped the saturation
value after HSV correction, while the CPU compositor did not, so this
patch unifies that behavior. Additionally, negative values are now
clamped in both the HSV node and Hue correction node to also match the
CPU compositor.
This commit is contained in:
Omar Emara
2023-05-09 14:22:35 +03:00
parent 322dab936f
commit f9b5b0efd2
2 changed files with 3 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ void node_composite_hue_correct(float factor,
hsv.y = clamp(hsv.y, 0.0, 1.0);
hsv_to_rgb(hsv, result);
result.rgb = max(result.rgb, vec3(0.0));
result = mix(color, result, factor);
}

View File

@@ -7,10 +7,11 @@ void node_composite_hue_saturation_value(
rgb_to_hsv(color, hsv);
hsv.x = fract(hsv.x + hue + 0.5);
hsv.y = clamp(hsv.y * saturation, 0.0, 1.0);
hsv.y = hsv.y * saturation;
hsv.z = hsv.z * value;
hsv_to_rgb(hsv, result);
result.rgb = max(result.rgb, vec3(0.0));
result = mix(color, result, factor);
}