Is there a documentation somewhere describing what the inputs of the HSV colorspace are.
It took me a while to discover, that the first input (hue) seems to be interpreted as an angle in degrees,
whereas the orthers are interpreted as relative strength with a zero to one range.
See this workspace:
The value ranges are mentioned in FromHSV() of Color3:
Original code:
private static _BlackReadOnly = Color3.Black() as DeepImmutable<Color3>;
/**
* Converts Hue, saturation and value to a Color3 (RGB)
* @param hue defines the hue
* @param saturation defines the saturation
* @param value defines the value
* @param result defines the Color3 where to store the RGB values
*/
public static HSVtoRGBToRef(hue: number, saturation: number, value: number, result: Color3) {
const chroma = value * saturation;
const h = hue / 60;
const x = chroma * (1 - Math.abs((h % 2) - 1));
let r = 0;
let g = 0;
let b = 0;
if (h >= 0 && h <= 1) {
r = chroma;
g = x;
Edit: I created the PR
BabylonJS:master
← Atsutakemura:patch-1
opened 08:02AM - 30 Jul 23 UTC
HSVtoRGBToRef() of Color3 was missing ranges of hue, saturation, and value param… eters:
Forum: https://forum.babylonjs.com/t/hsv-colorspace-hue-in-degrees/42796
3 Likes