RealDocs

UKismetMathLibrary::LinearColor_SetFromPow22

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

Description

Converts an FColor encoded with a simplified gamma-2.2 power curve (pow(v/255, 2.2)) into linear FLinearColor. This is a legacy conversion path; for colors from standard displays or color pickers prefer LinearColor_SetFromSRGB.

Caveats & Gotchas

  • The pow(2.2) curve is not identical to the sRGB standard — the sRGB spec has a linear segment below ~0.04045 to avoid infinite slope at zero. Using this function on sRGB source data introduces a small but measurable error in dark regions.
  • This function exists primarily for compatibility with older UE assets or tools that used a pure power-of-2.2 encoding. New code should default to LinearColor_SetFromSRGB unless you have confirmed your source uses the exact 2.2 power curve.

Signature

static UE_INL_API void LinearColor_SetFromPow22(UPARAM(ref) FLinearColor& InOutColor, const FColor& InColor)

Parameters

Name Type Description Default
InOutColor FLinearColor& The LinearColor variable to write the converted result into.
InColor const FColor& An 8-bit FColor encoded with a pure power-of-2.2 gamma curve (not the sRGB standard).

Return Type

void

Example

Convert a legacy pow-2.2 encoded color C++
FColor LegacyColor = FColor(180, 90, 40, 255);
FLinearColor LinearResult;
UKismetMathLibrary::LinearColor_SetFromPow22(LinearResult, LegacyColor);
// LinearResult is decoded as pow(channel/255, 2.2) per channel

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.