UKismetMathLibrary::Conv_LinearColorToColor
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Converts a FLinearColor to an 8-bit FColor, optionally applying sRGB gamma encoding. This is the standard path for converting engine linear colors to display-ready 8-bit values, for example before storing in a texture or passing to a UI widget.
Caveats & Gotchas
- • With InUseSRGB = true (the default), values > 1.0 are clamped before encoding — HDR linear colors will clip. If you need to preserve HDR data use LinearColor_ToRGBE instead.
- • InUseSRGB = false performs a raw floor-to-byte without gamma, equivalent to LinearColor_Quantize. Most display surfaces expect sRGB encoding, so passing false will produce colors that appear too dark on screen.
Signature
static UE_INL_API FColor Conv_LinearColorToColor(FLinearColor InLinearColor, bool InUseSRGB = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InLinearColor | FLinearColor | The linear-space color to convert. | — |
| InUseSRGB | bool | When true (default), applies sRGB gamma encoding before quantizing to 8-bit. When false, quantizes directly without gamma correction. | true |
Return Type
FColor Example
Convert a linear color to an 8-bit sRGB FColor for texture writing C++
FLinearColor LinearBlue(0.0f, 0.2f, 1.0f, 1.0f);
FColor SRGBBlue = UKismetMathLibrary::Conv_LinearColorToColor(LinearBlue, true);
// SRGBBlue is now ready for texture pixel writes or UI use See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?