Advertisement Jump to content
Sign in to follow this  

HSL with smoother transitions?

This topic is 1739 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts



It's extremely hard to explain with words, so I hope the image says it all:




The standard HSL color model looks like the image on the left.


Depending on which angle from your screen you look at it (im my case it's always visbile but more when looking from the bottom), you can clearly see that there is a horizontal line in the middle of the image. It's in fact just a difference in how it transitions, but the human eye/brain somehow makes a "line" of it. In addition, there are 3 such vertical lines, between the red and green, between the green and blue, and in the purple zone.


The red markings in the centermost image contain where those ugly lines are.


And the rightmost image shows a plot of a mathematical function (guess which) made with that very HSL color model. And there it is, the ugly line is visible there as well.


I'd like to make better looking plots. It should still be a HSL-like color model: still black at the bottom, white at the top (HSV is not white at the top), and all hues in the center. But smoothed in some way that no such obvious lines are visible.


I now use the standard HSL to RGB conversion function I already tried, after HSL to RGB, to set Y to the lightness with RGB->YUV->RGB conversion, but that looks even uglier, yellow becomes olive.


Does anyone know:


If there's a trick to make HSL color better for such mathematical plotting purpose?


What the phenomenon with the "lines" is called?


Another more suitable color model?


Share this post

Link to post
Share on other sites

I did some research on this a while back. I'm just going to link-dump on you, hopefully you can piece it together.

Further reading on HCL in particular and perceptually uniform color spaces in general should provide some guidance

Share this post

Link to post
Share on other sites

Thanks! HCL is not bad at all smile.png

I really like how smooth everything looks. The colors themselves are a bit too pink though, I just have to do some tweaking with mostly choosing the right chroma parameter I guess...




Edit: Well, in retrospect, I think HCL makes colors too bland... No real red sad.png I guess I need to find something that remains closer to the original HSL, in that it uses all possible things a computer monitor can do at the cost of accuracy, but at least doesn't have the visible bands that HSL has.

Edited by Lode

Share this post

Link to post
Share on other sites
Those lines are actually a manifestation of the fact that the RGB color space is a cube - the lines correspond to the edges and vertices of the RGB color cube. The appearance of the lines is further amplified by the device's gamma curve - this is why those lines are much more noticeable along brightness gradients than along hue gradients.

Gamma correction can help, but it really mostly helps brightness gradients, and causes some hue shifting for hues that are not primaries (pure blue, red, and green) or secondaries (pure yellow, cyan, and purple). The lines in hue gradients can be fixed by using a color space with curved boundaries in RGB space (like HCL), but as you've noticed, that comes at the cost of losing highly saturated primaries and secondaries

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!