UKismetMathLibrary::LinearColor_SetTemperature
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Sets a LinearColor to the RGB chromaticity of a black body radiator at the given temperature in Kelvin, approximating physical light source colors. Common values: 1900 K (candle), 3200 K (tungsten), 5500 K (daylight), 9000 K (overcast sky).
Caveats & Gotchas
- • The alpha channel is not modified — InOutColor.A retains whatever value it had before the call. Initialize or set alpha separately if needed.
- • The computation uses a curve-fit approximation, not a full spectral power distribution integral. Results are perceptually correct for artistic use but will not match a spectroradiometer reading.
Signature
static UE_INL_API void LinearColor_SetTemperature(UPARAM(ref) FLinearColor& InOutColor, float InTemperature) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InOutColor | FLinearColor& | The LinearColor variable to write the result into. | — |
| InTemperature | float | Color temperature in Kelvin. Useful range is roughly 1000–15000 K. | — |
Return Type
void Example
Set a light color from a Kelvin temperature C++
FLinearColor LightColor;
LightColor.A = 1.0f;
UKismetMathLibrary::LinearColor_SetTemperature(LightColor, 3200.0f);
PointLightComponent->SetLightColor(LightColor); Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?