UKismetMathLibrary::RGBToHSV_Vector
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Converts a linear RGB FLinearColor to a packed HSV FLinearColor (H in R, S in G, V in B). Use this when you want to manipulate color in HSV space but work with FLinearColor containers throughout.
Caveats & Gotchas
- • The output FLinearColor's R channel holds hue in the range [0, 360) — not [0, 1]. Treating the result as a normal linear color (e.g., passing it to a material parameter expecting RGB) will produce wildly incorrect colours.
- • For achromatic inputs (grey), H is set to 0 and S is 0. When reconstructing via HSVToRGB_Vector, a round-trip through grey will always produce hue 0 regardless of the original hue.
Signature
static UE_INL_API void RGBToHSV_Vector(FLinearColor RGB, FLinearColor& HSV) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| RGB | FLinearColor | The linear RGB input color. | — |
| HSV | FLinearColor& | Output FLinearColor with H packed into R [0..360), S into G [0..1], V into B [0..1], and alpha passed through. | — |
Return Type
void Example
Pack RGB into HSV for storage C++
FLinearColor HSVPacked;
UKismetMathLibrary::RGBToHSV_Vector(FLinearColor(0.0f, 0.5f, 1.0f, 1.0f), HSVPacked);
// HSVPacked.R ~ 210, HSVPacked.G = 1.0, HSVPacked.B = 1.0 See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?