UKismetMathLibrary::RGBToHSV
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Decomposes a linear RGB FLinearColor into its hue, saturation, value, and alpha components as separate float outputs. Use this when you need to modify individual HSV components (e.g., boost brightness or shift hue) and then reconstruct the color.
Caveats & Gotchas
- • For achromatic colors (R == G == B), the hue is undefined. The implementation outputs H = 0 in that case, which is red — not a neutral value. Check S == 0 before trusting the hue output.
- • V is the maximum of the R, G, B channels in linear space, not perceptual brightness. Using V as a luminance proxy can give unintuitive results; use LinearColor_GetLuminance for perceptual brightness.
Signature
static UE_INL_API void RGBToHSV(FLinearColor InColor, float& H, float& S, float& V, float& A) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InColor | FLinearColor | The linear RGB color to decompose. | — |
| H | float& | Output hue in degrees [0.0, 360.0). | — |
| S | float& | Output saturation in [0.0, 1.0]. | — |
| V | float& | Output value (brightness) in [0.0, 1.0]. | — |
| A | float& | Output alpha, passed through from InColor.A unchanged. | — |
Return Type
void Example
Increase brightness of a color in HSV space C++
float H, S, V, A;
UKismetMathLibrary::RGBToHSV(OriginalColor, H, S, V, A);
V = FMath::Clamp(V * 1.5f, 0.0f, 1.0f);
FLinearColor Brighter = UKismetMathLibrary::HSVToRGB(H, S, V, A); See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?