Color 3 and 4 returns wrong color some times

I found this error seting scene.clearColor.
in certain combinations they return white or any other wrong color.
This happens, at least since version 4.1, 4.2 and 5 .0 alpha

See an example here:

Is color3 not a 0-1 range?
0 = 0
0.5 = 127 / 128
1 = 255

Maybe i remember wrong

If you want to use web colors, you need to use BABYLON.Color3.FromHexString("#someWebcolor")


Hi. color3 has linear range in values from 0 to 1 Color3 | Babylon.js Documentation so if you need convert values from not linear rgb color values you need calculate by formula linearValue = channelValue/255 so half gray color3 = 127.5/255, 127.5/255, 127.5/255 = 0.5, 0.5, 0.5 or as say labris use hex values and FromHexString.

1 Like

My mistake was that I did not understand the range of the parameters well.

Thank you very much and take care of you.

1 Like