|
CARLA
|
#include "CameraModelUtil.h"#include <util/ue-header-guard-begin.h>#include "Engine/TextureRenderTargetCube.h"#include "Engine/TextureRenderTarget2D.h"#include "GlobalShader.h"#include "ShaderParameterUtils.h"#include "PipelineStateCache.h"#include "RHIStaticStates.h"#include "RenderGraphBuilder.h"#include "RenderGraphUtils.h"#include <util/ue-header-guard-end.h>#include <cmath>Go to the source code of this file.
Namespaces | |
| namespace | CameraModelUtil |
| namespace | CameraModelUtil::BrownConrady |
| namespace | CameraModelUtil::FTheta |
| namespace | CameraModelUtil::KannalaBrandt |
| namespace | CameraModelUtil::LUT1D |
Macros | |
| #define | DECLARE_PERSPECTIVE_SHADER(NAME, CAMERA_MODEL) |
| #define | DECLARE_WIDE_ANGLE_LENS_SHADER(NAME, CAMERA_MODEL) |
Enumerations | |
| enum | WideAngleLensShaderFlags : uint32 { WAL_SHADER_FLAGS_EQUIRECTANGULAR = 1U << 0 , WAL_SHADER_FLAGS_FOV_MASK = 1U << 1 } |
Functions | |
| template<typename FShaderType> | |
| static void | ApplyDistortion (FRDGBuilder &GraphBuilder, FRDGTextureRef Destination, FRDGTextureRef CubeTextures[6], FRHISamplerState *Sampler, FIntPoint Size, const CameraModelUtil::FDistortCubemapToImageOptions &Options, FVector4f CameraParams) |
| static void | ApplyDistortionKannalaBrandt (FRDGBuilder &GraphBuilder, FRDGTextureRef Destination, FRDGTextureRef CubeTextures[6], FRHISamplerState *Sampler, FIntPoint Size, const CameraModelUtil::FDistortCubemapToImageOptions &Options, FVector4f CameraParams) |
| static void | ApplyDistortionLUT1D (FRDGBuilder &GraphBuilder, FRDGTextureRef Destination, FRDGTextureRef CubeTextures[6], FRHISamplerState *Sampler, FIntPoint Size, const CameraModelUtil::FDistortCubemapToImageOptions &Options, FVector4f CameraParams) |
| float | CameraModelUtil::ComputeAngle (ECameraModel CameraModel, float Distance, TArrayView< const float > Coefficients) |
| float | CameraModelUtil::KannalaBrandt::ComputeCameraPolynomial (float Theta, TArrayView< const float > Coefficients) |
| float | CameraModelUtil::KannalaBrandt::ComputeCameraPolynomialDerivative (float Theta, TArrayView< const float > Coefficients) |
| float | CameraModelUtil::ComputeDistance (ECameraModel CameraModel, float Angle, int32 ImageHeight, TArrayView< const float > Coefficients) |
| FVector2f | CameraModelUtil::ComputeLensImagePoint (const FLensModelDescriptor &Descriptor, FVector Direction, ELensColorChannel Channel) |
| FVector | CameraModelUtil::ComputeLensRayDirection (const FLensModelDescriptor &Descriptor, FVector2f ImagePoint, ELensColorChannel Channel) |
| template<typename FShaderType> | |
| static auto | CreateDistortionParameters (FRDGBuilder &GraphBuilder, FRDGTextureRef Destination, FRDGTextureRef CubeTextures[6], FRHISamplerState *Sampler, const CameraModelUtil::FDistortCubemapToImageOptions &Options, FVector4f CameraParams) |
| DECLARE_PERSPECTIVE_SHADER (FToPerspectiveShader_Custom, ECameraModel::KannalaBrandt) | |
| DECLARE_PERSPECTIVE_SHADER (FToPerspectiveShader_Equidistance, ECameraModel::Equidistant) | |
| DECLARE_PERSPECTIVE_SHADER (FToPerspectiveShader_Equisolid, ECameraModel::Equisolid) | |
| DECLARE_PERSPECTIVE_SHADER (FToPerspectiveShader_Orthogonal, ECameraModel::Orthographic) | |
| DECLARE_PERSPECTIVE_SHADER (FToPerspectiveShader_Perspective, ECameraModel::Perspective) | |
| DECLARE_PERSPECTIVE_SHADER (FToPerspectiveShader_Stereographic, ECameraModel::Stereographic) | |
| DECLARE_WIDE_ANGLE_LENS_SHADER (FWideAngleLensShader_Custom, ECameraModel::KannalaBrandt) | |
| DECLARE_WIDE_ANGLE_LENS_SHADER (FWideAngleLensShader_Equidistance, ECameraModel::Equidistant) | |
| DECLARE_WIDE_ANGLE_LENS_SHADER (FWideAngleLensShader_Equisolid, ECameraModel::Equisolid) | |
| DECLARE_WIDE_ANGLE_LENS_SHADER (FWideAngleLensShader_LUT1D, ECameraModel::LUT1D) | |
| DECLARE_WIDE_ANGLE_LENS_SHADER (FWideAngleLensShader_Orthogonal, ECameraModel::Orthographic) | |
| DECLARE_WIDE_ANGLE_LENS_SHADER (FWideAngleLensShader_Perspective, ECameraModel::Perspective) | |
| DECLARE_WIDE_ANGLE_LENS_SHADER (FWideAngleLensShader_Stereographic, ECameraModel::Stereographic) | |
| template<typename FShaderType> | |
| static void | DispatchDistortion (FRDGBuilder &GraphBuilder, typename FShaderType::FParameters *Parameters, FIntPoint Size) |
| FVector2f | CameraModelUtil::BrownConrady::Distort (float Xn, float Yn, TArrayView< const float > Coefficients) |
| void | CameraModelUtil::DistortCubemapToImage (FRDGBuilder &GraphBuilder, FRDGTexture *Destination, FRDGTexture **CubeTextures, FRHISamplerState *Sampler, const FDistortCubemapToImageOptions &Options) |
| void | CameraModelUtil::DistortCubemapToImage (FRDGBuilder &GraphBuilder, UTextureRenderTarget2D *Destination, UTextureRenderTarget2D **CubeRenderTargets, FRHISamplerState *Sampler, const FDistortCubemapToImageOptions &Options) |
| static void | CameraModelUtil::BrownConrady::EvalWithJacobian (float Xn, float Yn, TArrayView< const float > C, float &OutXd, float &OutYd, float OutJ[4]) |
| FRHISamplerState * | CameraModelUtil::GetSampler (ESamplerFilter Filter) |
| IMPLEMENT_SHADER_TYPE (, FToPerspectiveShader_Custom, TEXT("/Plugin/Carla/ToPerspective.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FToPerspectiveShader_Equidistance, TEXT("/Plugin/Carla/ToPerspective.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FToPerspectiveShader_Equisolid, TEXT("/Plugin/Carla/ToPerspective.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FToPerspectiveShader_Orthogonal, TEXT("/Plugin/Carla/ToPerspective.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FToPerspectiveShader_Perspective, TEXT("/Plugin/Carla/ToPerspective.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FToPerspectiveShader_Stereographic, TEXT("/Plugin/Carla/ToPerspective.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FWideAngleLensShader_Custom, TEXT("/Plugin/Carla/WideAngleLens.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FWideAngleLensShader_Equidistance, TEXT("/Plugin/Carla/WideAngleLens.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FWideAngleLensShader_Equisolid, TEXT("/Plugin/Carla/WideAngleLens.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FWideAngleLensShader_LUT1D, TEXT("/Plugin/Carla/WideAngleLens.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FWideAngleLensShader_Orthogonal, TEXT("/Plugin/Carla/WideAngleLens.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FWideAngleLensShader_Perspective, TEXT("/Plugin/Carla/WideAngleLens.usf"), TEXT("MainCS"), SF_Compute) | |
| IMPLEMENT_SHADER_TYPE (, FWideAngleLensShader_Stereographic, TEXT("/Plugin/Carla/WideAngleLens.usf"), TEXT("MainCS"), SF_Compute) | |
| FVector | CameraModelUtil::LensDirToUE (FVector LensDir) |
| float | CameraModelUtil::FTheta::Polynomial (float Distance, TArrayView< const float > Coefficients) |
| static float | CameraModelUtil::RadialForward (ECameraModel Model, float Theta, TArrayView< const float > Coeffs, TArrayView< const float > LUT, float ThetaMax) |
| static float | CameraModelUtil::RadialInverse (ECameraModel Model, float Distance, TArrayView< const float > Coeffs, TArrayView< const float > LUT, float ThetaMax) |
| float | CameraModelUtil::LUT1D::SampleForward (float Theta, TArrayView< const float > Samples, float ThetaMax) |
| float | CameraModelUtil::LUT1D::SampleInverse (float Distance, TArrayView< const float > Samples, float ThetaMax) |
| static float | CameraModelUtil::SelectCAScale (const FLensModelDescriptor &Descriptor, ELensColorChannel Channel) |
| float | CameraModelUtil::FTheta::SolveRadius (float Theta, TArrayView< const float > Coefficients, int32 Iterations) |
| template<typename FShaderType> | |
| static void | ToPerspective (FRDGBuilder &GraphBuilder, FRDGTextureRef Destination, FRDGTextureRef Source, FRHISamplerState *Sampler, float YFOVAngle, float DestinationFocalDistance, float SourceFocalDistance, FIntPoint Size) |
| static void | ToPerspective (FRDGBuilder &GraphBuilder, FRDGTextureRef Destination, FRDGTextureRef Source, FRHISamplerState *Sampler, float YFOVAngle, float DestinationFocalDistance, float SourceFocalDistance, FIntPoint Size, TArrayView< const float > KannalaBrandtCoefficients) |
| FVector | CameraModelUtil::UEDirToLens (FVector UEDir) |
| FVector2f | CameraModelUtil::BrownConrady::Undistort (float Xd, float Yd, TArrayView< const float > Coefficients, int32 Iterations) |
Variables | |
| static constexpr std::pair< const TCHAR *, uint32 > | CommonShaderDefinitions [] |
| static const auto | KannalaBrandtSolverIterations = 32U |
| static const auto | SubgroupSize = 32U |
| static const auto | WorkPerInvocation = static_cast<uint32>(64U / sizeof(FVector4f)) |
| #define DECLARE_PERSPECTIVE_SHADER | ( | NAME, | |
| CAMERA_MODEL ) |
Definition at line 180 of file CameraModelUtil.cpp.
Referenced by DECLARE_PERSPECTIVE_SHADER(), DECLARE_PERSPECTIVE_SHADER(), DECLARE_PERSPECTIVE_SHADER(), DECLARE_PERSPECTIVE_SHADER(), DECLARE_PERSPECTIVE_SHADER(), and DECLARE_PERSPECTIVE_SHADER().
| #define DECLARE_WIDE_ANGLE_LENS_SHADER | ( | NAME, | |
| CAMERA_MODEL ) |
Definition at line 152 of file CameraModelUtil.cpp.
Referenced by DECLARE_WIDE_ANGLE_LENS_SHADER(), DECLARE_WIDE_ANGLE_LENS_SHADER(), DECLARE_WIDE_ANGLE_LENS_SHADER(), DECLARE_WIDE_ANGLE_LENS_SHADER(), DECLARE_WIDE_ANGLE_LENS_SHADER(), DECLARE_WIDE_ANGLE_LENS_SHADER(), and DECLARE_WIDE_ANGLE_LENS_SHADER().
| enum WideAngleLensShaderFlags : uint32 |
| Enumerator | |
|---|---|
| WAL_SHADER_FLAGS_EQUIRECTANGULAR | |
| WAL_SHADER_FLAGS_FOV_MASK | |
Definition at line 24 of file CameraModelUtil.cpp.
|
static |
Definition at line 280 of file CameraModelUtil.cpp.
References ApplyDistortion(), CreateDistortionParameters(), and DispatchDistortion().
Referenced by ApplyDistortion(), and CameraModelUtil::DistortCubemapToImage().
|
static |
Definition at line 294 of file CameraModelUtil.cpp.
References ApplyDistortionKannalaBrandt(), CreateDistortionParameters(), DispatchDistortion(), and CameraModelUtil::FDistortCubemapToImageOptions::KannalaBrandtCoefficients.
Referenced by ApplyDistortionKannalaBrandt(), and CameraModelUtil::DistortCubemapToImage().
|
static |
Definition at line 323 of file CameraModelUtil.cpp.
References ApplyDistortionLUT1D(), CreateDistortionParameters(), DispatchDistortion(), CameraModelUtil::FDistortCubemapToImageOptions::LUT, and CameraModelUtil::FDistortCubemapToImageOptions::ThetaMax.
Referenced by ApplyDistortionLUT1D(), and CameraModelUtil::DistortCubemapToImage().
|
static |
Definition at line 224 of file CameraModelUtil.cpp.
References CameraModelUtil::FDistortCubemapToImageOptions::bFOVMaskEnable, CameraModelUtil::FDistortCubemapToImageOptions::bRenderEquirectangular, CreateDistortionParameters(), CameraModelUtil::FDistortCubemapToImageOptions::FOVFadeSize, CameraModelUtil::FDistortCubemapToImageOptions::InvalidColor, CameraModelUtil::FDistortCubemapToImageOptions::LongitudeOffset, WAL_SHADER_FLAGS_EQUIRECTANGULAR, WAL_SHADER_FLAGS_FOV_MASK, and CameraModelUtil::FDistortCubemapToImageOptions::YFOVAngle.
Referenced by ApplyDistortion(), ApplyDistortionKannalaBrandt(), ApplyDistortionLUT1D(), and CreateDistortionParameters().
| DECLARE_PERSPECTIVE_SHADER | ( | FToPerspectiveShader_Custom | , |
| ECameraModel::KannalaBrandt | ) |
References DECLARE_PERSPECTIVE_SHADER, and KannalaBrandt.
| DECLARE_PERSPECTIVE_SHADER | ( | FToPerspectiveShader_Equidistance | , |
| ECameraModel::Equidistant | ) |
References DECLARE_PERSPECTIVE_SHADER, and Equidistant.
| DECLARE_PERSPECTIVE_SHADER | ( | FToPerspectiveShader_Equisolid | , |
| ECameraModel::Equisolid | ) |
References DECLARE_PERSPECTIVE_SHADER, and Equisolid.
| DECLARE_PERSPECTIVE_SHADER | ( | FToPerspectiveShader_Orthogonal | , |
| ECameraModel::Orthographic | ) |
References DECLARE_PERSPECTIVE_SHADER, and Orthographic.
| DECLARE_PERSPECTIVE_SHADER | ( | FToPerspectiveShader_Perspective | , |
| ECameraModel::Perspective | ) |
References DECLARE_PERSPECTIVE_SHADER, and Perspective.
| DECLARE_PERSPECTIVE_SHADER | ( | FToPerspectiveShader_Stereographic | , |
| ECameraModel::Stereographic | ) |
References DECLARE_PERSPECTIVE_SHADER, and Stereographic.
| DECLARE_WIDE_ANGLE_LENS_SHADER | ( | FWideAngleLensShader_Custom | , |
| ECameraModel::KannalaBrandt | ) |
References DECLARE_WIDE_ANGLE_LENS_SHADER, and KannalaBrandt.
| DECLARE_WIDE_ANGLE_LENS_SHADER | ( | FWideAngleLensShader_Equidistance | , |
| ECameraModel::Equidistant | ) |
References DECLARE_WIDE_ANGLE_LENS_SHADER, and Equidistant.
| DECLARE_WIDE_ANGLE_LENS_SHADER | ( | FWideAngleLensShader_Equisolid | , |
| ECameraModel::Equisolid | ) |
References DECLARE_WIDE_ANGLE_LENS_SHADER, and Equisolid.
| DECLARE_WIDE_ANGLE_LENS_SHADER | ( | FWideAngleLensShader_LUT1D | , |
| ECameraModel::LUT1D | ) |
References DECLARE_WIDE_ANGLE_LENS_SHADER, and LUT1D.
| DECLARE_WIDE_ANGLE_LENS_SHADER | ( | FWideAngleLensShader_Orthogonal | , |
| ECameraModel::Orthographic | ) |
References DECLARE_WIDE_ANGLE_LENS_SHADER, and Orthographic.
| DECLARE_WIDE_ANGLE_LENS_SHADER | ( | FWideAngleLensShader_Perspective | , |
| ECameraModel::Perspective | ) |
References DECLARE_WIDE_ANGLE_LENS_SHADER, and Perspective.
| DECLARE_WIDE_ANGLE_LENS_SHADER | ( | FWideAngleLensShader_Stereographic | , |
| ECameraModel::Stereographic | ) |
References DECLARE_WIDE_ANGLE_LENS_SHADER, and Stereographic.
|
static |
Definition at line 255 of file CameraModelUtil.cpp.
References DispatchDistortion(), and SubgroupSize.
Referenced by ApplyDistortion(), ApplyDistortionKannalaBrandt(), ApplyDistortionLUT1D(), and DispatchDistortion().
| IMPLEMENT_SHADER_TYPE | ( | FToPerspectiveShader_Custom | , |
| TEXT("/Plugin/Carla/ToPerspective.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FToPerspectiveShader_Equidistance | , |
| TEXT("/Plugin/Carla/ToPerspective.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FToPerspectiveShader_Equisolid | , |
| TEXT("/Plugin/Carla/ToPerspective.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FToPerspectiveShader_Orthogonal | , |
| TEXT("/Plugin/Carla/ToPerspective.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FToPerspectiveShader_Perspective | , |
| TEXT("/Plugin/Carla/ToPerspective.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FToPerspectiveShader_Stereographic | , |
| TEXT("/Plugin/Carla/ToPerspective.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FWideAngleLensShader_Custom | , |
| TEXT("/Plugin/Carla/WideAngleLens.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FWideAngleLensShader_Equidistance | , |
| TEXT("/Plugin/Carla/WideAngleLens.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FWideAngleLensShader_Equisolid | , |
| TEXT("/Plugin/Carla/WideAngleLens.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FWideAngleLensShader_LUT1D | , |
| TEXT("/Plugin/Carla/WideAngleLens.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FWideAngleLensShader_Orthogonal | , |
| TEXT("/Plugin/Carla/WideAngleLens.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FWideAngleLensShader_Perspective | , |
| TEXT("/Plugin/Carla/WideAngleLens.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
Referenced by IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), IMPLEMENT_SHADER_TYPE(), and IMPLEMENT_SHADER_TYPE().
| IMPLEMENT_SHADER_TYPE | ( | FWideAngleLensShader_Stereographic | , |
| TEXT("/Plugin/Carla/WideAngleLens.usf") | , | ||
| TEXT("MainCS") | , | ||
| SF_Compute | ) |
References IMPLEMENT_SHADER_TYPE().
|
static |
Definition at line 361 of file CameraModelUtil.cpp.
References SubgroupSize, ToPerspective(), and WorkPerInvocation.
Referenced by CameraModelUtil::DistortCubemapToImage(), ToPerspective(), and ToPerspective().
|
static |
Definition at line 396 of file CameraModelUtil.cpp.
References SubgroupSize, ToPerspective(), and WorkPerInvocation.
|
staticconstexpr |
Definition at line 39 of file CameraModelUtil.cpp.
|
static |
Definition at line 34 of file CameraModelUtil.cpp.
Referenced by CameraModelUtil::ComputeAngle(), and CameraModelUtil::RadialInverse().
|
static |
Definition at line 32 of file CameraModelUtil.cpp.
Referenced by DispatchDistortion(), ToPerspective(), and ToPerspective().
|
static |
Definition at line 33 of file CameraModelUtil.cpp.
Referenced by ToPerspective(), and ToPerspective().