UKismetMathLibrary::LinearColor_GetLuminance
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the perceptual luminance of a linear color using standard human-eye channel weights (green contributes most, blue least). Use this when you need a single brightness value that matches how bright the color looks on screen.
Caveats & Gotchas
- • Uses the Rec. 709 luminance coefficients (R*0.2126, G*0.7152, B*0.0722) — appropriate for linear (gamma-decoded) colors. Applying it to a gamma-encoded sRGB color will give inaccurate results.
- • The alpha channel is ignored in the luminance calculation.
Signature
static UE_INL_API float LinearColor_GetLuminance(FLinearColor InColor); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InColor | FLinearColor | Color to compute luminance for. | — |
Return Type
float Example
Branch on perceived brightness C++
FLinearColor SurfaceColor = /* sample from material */;
float Lum = UKismetMathLibrary::LinearColor_GetLuminance(SurfaceColor);
bool bIsBright = Lum > 0.5f; Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?