UKismetMathLibrary::LinearColor_QuantizeRound
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Quantizes a FLinearColor to an 8-bit FColor by rounding each channel to the nearest integer (rather than truncating), bypassing sRGB gamma conversion. This is the replacement for the deprecated LinearColor_Quantize.
Caveats & Gotchas
- • Like LinearColor_Quantize, this bypasses gamma — output is in linear space, not sRGB. For display-correct output on a standard monitor use Conv_LinearColorToColor with InUseSRGB = true.
- • Values outside [0.0, 1.0] are clamped to [0, 255] after scaling. HDR linear values > 1.0 will all map to 255.
Signature
static UE_INL_API FColor LinearColor_QuantizeRound(FLinearColor InColor) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InColor | FLinearColor | The linear color to quantize to 8-bit values using rounding. | — |
Return Type
FColor Example
Quantize a linear color to bytes with rounding C++
FLinearColor Lin(0.502f, 0.251f, 0.749f, 1.0f);
FColor Quantized = UKismetMathLibrary::LinearColor_QuantizeRound(Lin);
// Quantized.R == 128, .G == 64, .B == 191 (rounded, linear space) Version History
Introduced in: 4.20
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?