RealDocs

UKismetMathLibrary::LinearColor_ToRGBE

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Encodes a high-dynamic-range FLinearColor into the 8-bit RGBE format described in Gregory Ward's 'Real Pixels' (Graphics Gems II, p.80), where the shared exponent is stored in the alpha channel. Used for compact HDR storage when full float precision is not needed.

Caveats & Gotchas

  • The alpha channel of the FColor output stores the shared exponent, not opacity. The result cannot be used as a regular RGBA color — passing it to functions expecting standard 8-bit RGBA will produce garbage.
  • RGBE encoding loses precision for very dark values and cannot represent exact zero — the minimum representable value is around 10^-38. If your input contains 0.0 channels, they will be encoded as a small non-zero value.

Signature

static UE_INL_API FColor LinearColor_ToRGBE(FLinearColor InLinearColor)

Parameters

Name Type Description Default
InLinearColor FLinearColor The HDR linear color to encode.

Return Type

FColor

Example

Encode an HDR color for compact storage C++
FLinearColor HDRLight(5.2f, 4.8f, 3.1f, 1.0f); // brighter than LDR
FColor RGBE = UKismetMathLibrary::LinearColor_ToRGBE(HDRLight);
// RGBE.A is the shared exponent; RGBE.R/G/B are mantissas

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.