Download

FLinearColor - how to apply hue?

This is a bit confusing to me. FLinerColor has some functions like to convert it to HSL, but on other hand, it has no access to seperate H or S or L, only direct access to RGB.
I have 0f-1.0f slider, and I wanted to apply hue to FLinearColor based on that. But because I can not retrieve actual HSL values from FLinerColor, I am now lost between three oaks.


//get RGB linear color from somewhere
FLinearColor RGB = ...;

//conversion to HSV
FLinearColor HSV = RGB.LinearRGBToHSV();
const float Hue = HSV.R;
const float Saturation = HSV.G;
const float Value = HSV.B;
const float A = HSV.A;

//modify HSV based on slider value
...

//convert back
FLinearColor RGB2 = HSV.HSVToLinearRGB();

NOTE: the above is for HSV NOT HSL! You’ll need to do the necessary conversion yourself

I see! Thank you! SO RGB were actually just storing the HSV values.