ULensDistortionModelHandlerBase

Asset user data that can be used on Camera Actors to manage lens distortion state and utilities

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

CameraCalibrationCore

Header

/Engine/Plugins/VirtualProduction/CameraCalibrationCore/Source/CameraCalibrationCore/Public/LensDistortionModelHandlerBase.h

Include

#include "LensDistortionModelHandlerBase.h"

Syntax

UCLASS(Abstract)
class ULensDistortionModelHandlerBase : public UObject

Remarks

Asset user data that can be used on Camera Actors to manage lens distortion state and utilities

Variables

Name Description

Protected variable UProperty Category, EditAnywhere, Meta BlueprintReadOnly

FLensDistortion...

 

CurrentState

Current state as set by the most recent call to Update()

Protected variable UProperty Category visibleanywhere

FString

 

DisplayName

Display name, used to identify handler in-editor details panels

Protected variable UProperty Transient

UMaterialInstan...

 

DistortionDisplacementMapMID

MID used to draw the distortion displacement map

Protected variable UProperty Transient

UTextureRenderT...

 

DistortionDisplacementMapRT

UV displacement map used to distort an undistorted image

Protected variable UProperty Category BlueprintReadOnly visibleanywhere

UMaterialInstan...

 

DistortionPostProcessMID

Dynamically created post-process material instance for the currently specified lens model

Protected variable UProperty

FGuid

 

DistortionProducerID

UObject that is producing the distortion state for this handler

Protected variable UProperty Category BlueprintReadWrite visibleanywhere

TSubclassOf< UL...

 

LensModelClass

Create the distortion MIDs Set the material parameters for the displacement map and distortion post-process materials Convert the generic distortion parameter array into the specific structure of parameters used by the supported lens model Lens Model describing how to interpret the distortion parameters

Protected variable UProperty Category BlueprintReadOnly visibleanywhere

float

 

OverscanFactor

Computed overscan factor needed to scale the camera's FOV (read-only)

Protected variable UProperty Transient

UMaterialInstan...

 

UndistortionDisplacementMapMID

MID used to draw the undistortion displacement map

Protected variable UProperty Transient

UTextureRenderT...

 

UndistortionDisplacementMapRT

UV displacement map used to undistort a distorted image

Constructors

Functions

Name Description

Public function Const

float

 

ComputeOverscanFactor()

Use the current distortion state to compute the overscan factor needed such that all distorted UVs will fall into the valid range of [0,1]

Public function

void

 

CreateDisplacementMaps

(
    const FIntPoint DisplacementMapReso...
)

Create two displacement maps, for distortion and undistortion, using the input resolution

Public function

bool

 

DrawDistortionDisplacementMap

(
    UTextureRenderTarget2D* Destin...
)

Draw the distortion displacement map associated with the current state to the DestinationTexture

Public function

bool

 

DrawUndistortionDisplacementMap

(
    UTextureRenderTarget2D* Destin...
)

Draw the undistortion displacement map associated with the current state to the DestinationTexture

Public function Const

FLensDistort...

 

GetCurrentDistortionState()

Get the current distortion state (the lens model and properties that mathematically represent the distortion characteristics

Public function Const

FString

 

GetDisplayName()

Get the display name of this lens distortion model handler

Public function Const

TArray< FVec...

 

GetDistortedUVs

(
    TConstArrayView< FVector2D > Undist...
)

Computes the distorted version of UndistortedUVs based on the current state

Public function Const UFunction BlueprintCallable, Category

UTextureRend...

 

GetDistortionDisplacementMap()

Get the UV displacement map used to distort an undistorted image

Public function Const

UMaterialIns...

 

GetDistortionMID()

Get the post-process MID for the currently specified lens model

Public function Const

FGuid

 

GetDistortionProducerID()

Get the UObject that produces the distortion state for this handler

Public function Const

FVector2D

 

GetFxFy()

Get the normalized focal length (unitless)

Public function Const

const TSubcl...

 

GetLensModelClass()

Get the specified lens model that characterizes the distortion effect

Public function Const

float

 

GetOverscanFactor()

Returns the last overscan factor that was set

Public function Const

FVector2D

 

GetPrincipalPoint()

Get the normalized center of projection of the image, in the range [0.0f, 1.0f]

Public function Const UFunction BlueprintCallable, Category

UTextureRend...

 

GetUndistortionDisplacementMap()

Get the UV displacement map used to undistort a distorted image

Public function Const UFunction BlueprintCallable, Category

bool

 

IsModelSupported

(
    const TSubclassOf< ULensModel >& M...
)

Returns true if the input model is supported by this model handler, false otherwise.

Public function

void

 

ProcessCurrentDistortion()

Draws the current distortion state to the internal displacement map

Public function

void

 

SetDisplayName

(
    FString InDisplayName
)

Set the display name of this lens distortion model handler

Public function

void

 

SetDistortionProducerID

(
    const FGuid& InDistortionProducerI...
)

Set the UObject that produces the distortion state for this handler

Public function UFunction BlueprintCallable, Category

void

 

SetDistortionState

(
    const FLensDistortionState& InNewS...
)

Update the lens distortion state, recompute the overscan factor, and set all material parameters

Public function

void

 

SetOverscanFactor

(
    float OverscanFactor
)

Updates overscan factor and applies to material instances

Overridden from UObject

Name Description

Public function Virtual

void

 

PostEditChangeChainProperty

(
    FPropertyChangedChainEvent& Proper...
)

This alternate version of PostEditChange is called when properties inside structs are modified.

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.