Wintermute Engine Forum

Wintermute Engine => Bug reports => Not a bug => Topic started by: FogGobbler on August 17, 2007, 04:11:54 PM

Title: HSL Value .. Bug?
Post by: FogGobbler on August 17, 2007, 04:11:54 PM
Hi!

I´ve probably found a small bug, but I´m not quite sure.

This ismy little test-code:
Code: [Select]
  H = GetHValue(MakeRGBA(255,0,255));
  S = GetSValue(MakeRGBA(255,0,255));
  L = GetLValue(MakeRGBA(255,0,255));
 
  Game.Msg("H: "+H); Sleep(200);
  Game.Msg("S: "+S);Sleep(200);
  Game.Msg("L: "+L);Sleep(200);

RGB (255,0,255) is a light pink color. If I look at the ambient light picker (in the scene editor) that calculates the HSL for a RGB color I get the following HSL : 213, 255, 128

My little test program results: 212, 255, 127
Title: Re: HSL Value .. Bug?
Post by: Mnemonic on August 19, 2007, 12:00:03 PM
Considering how the color-space conversion works, there can be small imprecisions caused by rounding. For example if I set the same color in Paint Shop Pro, I get 212, 255, 127 just like in WME.
Title: Re: HSL Value .. Bug?
Post by: jbw on August 24, 2007, 01:53:23 AM
Considering how the color-space conversion works, there can be small imprecisions caused by rounding.

Computing HSL as a double precission "fractions of one" I got: 0.833333..., 1, 0.5
Casted to 0..255 range it means 212.5, 255, 127,5 that imo should be rounded to 213, 255, 128

But obviously both methods does very rough estimation and never gives the same color when we convert between RGB & HSL forth and back.

Of course such differences are practically indistinguishable by human eye.