UKismetMathLibrary::Conv_VectorToLinearColor
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Converts a 3D vector to an FLinearColor by mapping X to R, Y to G, Z to B, and setting Alpha to 1.0.
Caveats & Gotchas
- • Alpha is always set to 1.0 (fully opaque). Modify the result's A field afterward if you need a different alpha value.
- • Vector components are not clamped. Values outside [0, 1] produce an HDR color, which is valid for linear workflows but can produce unexpected results when passed to functions expecting normalized 0–1 channels.
Signature
static UE_INL_API FLinearColor Conv_VectorToLinearColor(FVector InVec); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InVec | FVector | The vector whose X, Y, Z map to R, G, B respectively. | — |
Return Type
FLinearColor Example
Encode a surface normal as a debug color C++
// Remap normal from [-1,1] to [0,1] for color display
FVector Normal = HitResult.ImpactNormal;
FLinearColor DebugColor = UKismetMathLibrary::Conv_VectorToLinearColor(Normal * 0.5f + FVector(0.5f));
DrawDebugPoint(GetWorld(), HitResult.ImpactPoint, 10.f, DebugColor.ToFColor(true)); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?