UKismetMathLibrary::LinearColorLerpUsingHSV
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Interpolates between two linear RGB colors by converting to HSV, taking the shortest hue path, interpolating, then converting back to RGB. Produces more vivid midpoint colors than a straight RGB lerp at the cost of extra computation.
Caveats & Gotchas
- • Significantly more expensive than LinearColorLerp due to two color-space conversions per call — avoid calling every frame for many objects without profiling.
- • Hue interpolation takes the shortest angular path, so a transition from 10° to 350° hue goes through 0° (red) rather than through the full spectrum.
- • Achromatic colors (pure blacks, whites, greys) have undefined hue — blending to or from grey may produce unexpected hue shifts.
Signature
static UE_INL_API FLinearColor LinearColorLerpUsingHSV(FLinearColor A, FLinearColor B, float Alpha); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FLinearColor | Start color in linear RGB (Alpha=0 result). | — |
| B | FLinearColor | End color in linear RGB (Alpha=1 result). | — |
| Alpha | float | Blend factor in [0,1]. | — |
Return Type
FLinearColor Example
Rainbow-style blend between two vivid hues C++
FLinearColor Start = FLinearColor(1.f, 0.f, 0.f, 1.f); // red
FLinearColor End = FLinearColor(0.f, 0.f, 1.f, 1.f); // blue
float T = 0.5f;
FLinearColor Mid = UKismetMathLibrary::LinearColorLerpUsingHSV(Start, End, T);
// Mid will be a vivid magenta rather than a desaturated purple Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?