Color3.FromHSV constructor needs more detailed documentation

Can anyone explain what type of input Color3.FromHSV(hue, saturation, value) uses?
they all accept numbers and I have come to the conclusion that saturation and value use numbers between [0-1], however I still can not understand clearly what type of range does Hue value have.

They are all 3 floats from 0 to 1.

If you want to know how they work, you might want to check this:

Edit: I tried it in playground, hue actually takes 0-360, while saturation & value is 0-1

1 Like

Go to API Color3 | Babylon.js Documentation
Click to Search playground for FromHSV
And got two examples Playground search page | Babylon.js Documentation
First of them call FromHSV with arguments BABYLON.Color3.FromHSV(165, 1, 1)
And second with BABYLON.Color3.FromHSV(240,1,150)

But source code (Babylon.js/math.color.ts at 37301b3f222eb9625c939148cecff72195fa1974 · BabylonJS/Babylon.js · GitHub) look like the function uses first arguments in 0-360 and others in 0-1

So, yes, it’s pretty confusing =)

1 Like

so first argument - Hue can be set anywhere from 0 to 360 right?
I tried to iterate through and change hue from 0 to 360 frame by frame and it seemed like I got every color on the specter.
Thanks

Yep it’s a bit confusing IMO and if it’s been awhile since I’ve used the function, I end up having to figure this out all over again too… :frowning:

So here’s a little PR to add the ranges to the API documentation. :slight_smile:

2 Likes