Gradient in UI Widget Issues

General questions and troubleshooting SOFTIMAGE©
Lord Futzi Voldemort
Posts: 440
Joined: 06 Jun 2009, 12:01

Gradient in UI Widget Issues

Post by Lord Futzi Voldemort » 30 May 2013, 14:52

Well, it's me again with another one:

Some time ago when I started to use color management in SI, I noticed a strange "knee" in the ui color widget gradient when turning color management on. I think I mentioned it somewhere in this forum before.
gradient_hsl_lin.png
Today I decided to measure what I'm seeing:
waveform_lin.jpg
Doesn't look like a correct gradient to me. This is without color management.
waveform_srgb.jpg
It's not just just a display thing, it affects rendering. I'm not sure what to make of this, but I'm quite certain a gradient shouldn't look like this. It doesn't in maya. I very much like using the HSL mode, because it is much easier to control. If it's coded correctly.
I haven't reported this yet, because I wanted to know who else finds this strange or if it's already known ( and just not fixed...)
This is SI 2013 but 2014 is the same. HSV seem ok.
You do not have the required permissions to view the files attached to this post.
I'm now part of an endangered species...

grahamef
Posts: 281
Joined: 23 Jun 2009, 19:01

Re: Gradient in UI Widget Issues

Post by grahamef » 30 May 2013, 17:30

I think that's normal with HLS. Remember that the L stands for Lightness and not Luminance as shown in your video scope. Lightness is an artificial quantity unrelated to any perceived quality.

What's happening in this particular case is that between 0 and 0.5, you've got increasing amounts of pure blue, which is the darkest of the standard RGB primaries, so the slope is fairly low. Between 0.5 and 1 you start adding the brighter red and green colors, so the slope increases. I'd expect that if you tried the same thing with pure green, the brightest of the primaries, or maybe yellow (R=G=1), the knee would bend in the opposite direction.

What do you mean when you say this doesn't happen in Maya? Is there a trick to get HLS color widgets in Maya?

Lord Futzi Voldemort
Posts: 440
Joined: 06 Jun 2009, 12:01

Re: Gradient in UI Widget Issues

Post by Lord Futzi Voldemort » 30 May 2013, 19:21

grahamef wrote:I think that's normal with HLS. Remember that the L stands for Lightness and not Luminance as shown in your video scope. Lightness is an artificial quantity unrelated to any perceived quality.

What's happening in this particular case is that between 0 and 0.5, you've got increasing amounts of pure blue, which is the darkest of the standard RGB primaries, so the slope is fairly low. Between 0.5 and 1 you start adding the brighter red and green colors, so the slope increases. I'd expect that if you tried the same thing with pure green, the brightest of the primaries, or maybe yellow (R=G=1), the knee would bend in the opposite direction.

What do you mean when you say this doesn't happen in Maya? Is there a trick to get HLS color widgets in Maya?
When I say it doesn't happen in maya, it actually means it doesn't happen in any other gradient I measured. (I only have the videoscope for this) What I don't understand is if this is an artificial value, why can it not be linear like every other value? Why are the other colors added at .5 and not at 0.0? Not that I don't believe you, I'm just trying to understand.
Unfortunately I cannot compare this to other hsl gradients - it seems in my toolset only SI has this mode.
I'm now part of an endangered species...

grahamef
Posts: 281
Joined: 23 Jun 2009, 19:01

Re: Gradient in UI Widget Issues

Post by grahamef » 30 May 2013, 23:10

Lord Futzi Voldemort wrote:When I say it doesn't happen in maya, it actually means it doesn't happen in any other gradient I measured. (I only have the videoscope for this) What I don't understand is if this is an artificial value, why can it not be linear like every other value? Why are the other colors added at .5 and not at 0.0? Not that I don't believe you, I'm just trying to understand.
Unfortunately I cannot compare this to other hsl gradients - it seems in my toolset only SI has this mode.
It's just the way HLS works. The Lightness scale on that widget is actually linear -- 0.5 is right in the middle, for example. However it doesn't look linear because lightness is not exactly luminance or anything else.

The way the relationships between RGB and HLS are defined, the hue is determined by the two strongest channels (or more precisely, by their relative values above the third channel), or a single channel in the case of a pure primary. If you start to mix in the third primary (or the other two primaries in the case of a pure primary) below L=0.5, you are actually affecting the hue and saturation too.

You can see the formulas here: http://en.wikipedia.org/wiki/HSL_and_HSV. If you try plugging some values in to them, the results in Softimage seem to conform. There are also some choice quotes from experts about HLS and HSV:
They are easy mathematical transformations of RGB, and they seem to be perceptual systems because they make use of the hue–lightness/value–saturation terminology. But take a close look; don’t be fooled.
and
HSB and HLS should be abandoned.
I don't fully agree with that last quote, in fact I prefer working with HLS over RGB when possible.

But speaking of "when possible", something just clicked with respect to your mention of color management... HLS and HSV are not valid for HDR images, i.e., when RGB values can be greater than 1.0.

Lord Futzi Voldemort
Posts: 440
Joined: 06 Jun 2009, 12:01

Re: Gradient in UI Widget Issues

Post by Lord Futzi Voldemort » 31 May 2013, 12:21

Thank you graham, for this useful information.
As much as I understand (visually ;-) ) the L gradient is in fact two gradients. The behavior from 0 to .5 is close to the V parameter in HSV, from .5 to one it shifts from pure color to white, which can of course only done by adding other colors. Depending on the primary color the "intensity" of the gradient at x 0.5 will vary (shift along y) while L=1 is of course 1. The way I get that knee in the middle.
While this isn't very apparent in srgb mode, it starts getting more perceptible when using gamma corrections (even if it's only for display) and mathematically very complicated when using HDR as you said.
This explains why you actually don't find HLS anywhere except in SI while HSV/HSB is found everywhere as alternative to RGB.*

I switched to HSV anyway some time ago, because maya uses it as a standard and pshop and nuke as well so it isn't really a problem. I just wanted to know....





* You'll find HSL in 3dcoat in as much as 4 flavors, but it's actually HSV with a wrong parameter naming ;-)
I'm now part of an endangered species...