[EFFECT] HSV

Completed plugins, behaviors and effects.

Post » Mon Jul 04, 2011 5:30 am

Adjust Hue, Saturation and Value.



Download HSV effect

Parameters:

- Hue : Hue shift in degrees (180 = opposite hues). Accept negative values.
- Saturation : Color saturation percentage. Values bigger than 100% oversaturate colors.
- Value : Value percentage. Adjust the "lightness".Animmaniac2011-07-04 05:33:25
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Tue Aug 02, 2011 4:47 pm

cool!
B
12
S
5
G
5
Posts: 80
Reputation: 3,572

Post » Fri Aug 26, 2011 6:03 pm

Hey, super-great effect, but there's a little problem - it seems to adjust something (looks like brightness) besides the hue.

Here's an example of a 255 RED object being hue-shifted using this effect:



And now the same thing in a graphics program:



Could something need fixing or is this just the way the graphics card does this?
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Fri Aug 26, 2011 10:03 pm

[QUOTE=Somebody] Hey, super-great effect, but there's a little problem - it seems to adjust something (looks like brightness) besides the hue.
Could something need fixing or is this just the way the graphics card does this?[/QUOTE]
This effect is an adaptation of a code I found on internet. It uses some pre-calculated values to speed things up and make it more feasible to be used as an real-time effect. I believe that probably there's some rounding going on that introduces some distortions.

I don't think that there's much way to improve it, since I don't know how the pre-calculated values were derived. Anyway, I may be wrong, since programming is not my expertise. But I think this distortions must be something intrinsic to this approach.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Fri Aug 26, 2011 11:15 pm

Ah, I understood as much by looking at the code. Unfortunately the rest was beyond me.

Converting RGB to HSV is a rather tricky process and it basically usually uses either picking out one of six cases or a tricky bitwise magic.

I managed to find a sample that uses the same transformation matrix (RGB to YIQ to HSV), read it through and checked all the values, but they appear to be correct. The only thing I'm not sure is - does the transform matrix need to be multiplied with the input colour?

Either way, thanks for your work on the effect.

Edit: Looking into it further it seems that the default transform values assume a default display gamma of 2.2 which may well be the case for our regular everyday visuals, but possibly less so for the DirectX based CC output. Thus the end result becomes darker? Not really sure.Somebody2011-08-26 23:32:21
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sat Aug 27, 2011 12:48 am

[QUOTE=Somebody]The only thing I'm not sure is - does the transform matrix need to be multiplied with the input colour?[/QUOTE]
Sure it needs, that's where the HSV transformations are applied to the original texture colors.

[QUOTE=Somebody]Looking into it further it seems that the default transform values assume a default display gamma of 2.2 which may well be the case for our regular everyday visuals, but possibly less so for the DirectX based CC output. Thus the end result becomes darker? Not really sure.[/QUOTE]
I have not enough knowledge about this subject, can't really tell you anything for sure.Animmaniac2011-08-27 00:50:13
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413


Return to Completed addons

Who is online

Users browsing this forum: No registered users and 0 guests