![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <CameraTypes.h>
Static Public Member Functions | |
| static ENGINE_API void | CalculateProjectionMatrixGivenView (FMinimalViewInfo &ViewInfo, TEnumAsByte< enum EAspectRatioAxisConstraint > AspectRatioAxisConstraint, class FViewport *Viewport, struct FSceneViewProjectionData &InOutProjectionData) |
| static ENGINE_API void | CalculateProjectionMatrixGivenViewRectangle (FMinimalViewInfo &ViewInfo, TEnumAsByte< enum EAspectRatioAxisConstraint > AspectRatioAxisConstraint, const FIntRect &ConstrainedViewRectangle, FSceneViewProjectionData &InOutProjectionData) |
|
inline |
| void FMinimalViewInfo::AddWeightedViewInfo | ( | const FMinimalViewInfo & | OtherView, |
| const float & | Weight | ||
| ) |
Combines this view with another one which will be weighted. Equals to this += OtherView * Weight.
| void FMinimalViewInfo::ApplyAsymmetricOverscan | ( | const FVector4f & | InAsymmetricOverscan, |
| bool | bScaleResolutionWithOverscan = false, |
||
| bool | bCropOverscan = false |
||
| ) |
Experimental: Apply asymmetric overscan to the view info, which scales the field of view, ortho width, aspect ratio, and off-center projection to simulate expanding the view frustum asymmetrically.
| InAsymmetricOverscan | - The amount of asymmetric overscan to apply, from 0.0 meaning no overscan to 1.0 meaning 100% overscan. By convention, X is the left overscan, Y is the right overscan, Z is the top overscan, and W is the bottom overscan. |
| bScaleResolutionWithOverscan | - Indicates that the view's resolution should be scaled with the amount of overscan, so that the original frustum remains the same resolution |
| bCropOverscan | - Indicates that the view should be cropped during the final post process pass to remove the overscanned pixels |
Applies weighting to this view, in order to be blended with another one. Equals to this *= Weight.
| void FMinimalViewInfo::ApplyOverscan | ( | float | InOverscan, |
| bool | bScaleResolutionWithOverscan = false, |
||
| bool | bCropOverscan = false |
||
| ) |
Apply overscan to the view info, which scales the field of view and ortho width to simulate expanding the view frustum.
| InOverscan | - The amount of overscan to apply, from 0.0 meaning no overscan to 1.0 meaning 100% overscan |
| bScaleResolutionWithOverscan | - Indicates that the view's resolution should be scaled with the amount of overscan, so that the original frustum remains the same resolution |
| bCropOverscan | - Indicates that the view should be cropped during the final post process pass to remove the overscanned pixels |
| bool FMinimalViewInfo::AutoCalculateOrthoPlanes | ( | FSceneViewProjectionData & | InOutProjectionData | ) |
Automatically calculates the Near/Far plane values for an Ortho camera
The CosAngle is the cosine of the angle between the ViewForward and camera down. Forcing the absolute value for this means that Up/Down is 1.0f and Forward (90 degrees) is 0. We use this to scale the Near Plane, and the far plane if 16 bit scaling is disabled.
We still max out at UE_OLD_WORLD_MAX or Max32FP, but we scale the FarPlane depending on ratio of the pixel size to the world unit size. Details below, but the reasoning is, we can't visibly see smaller than a pixel, so the passes that need 16bit buffers such as HZB have their plane distances scaled automatically depending on this ratio.
Default path if the 16bit scaling depth is disabled or not usable. Note: this path does not scale for 16 bit buffers, it only calculates Near/Far plane min/max automatically
The camera arm length is adjusted depending on the CosAngle as the horizontal view typically has a significantly larger plane range, so it becomes irrelevant, whereas it is necessary to account for in a top down view. Note: a small scene camera arm length will become irrelevant for a large ortho width.
The NearPlane calculation is a scaled OrthoHeight depending on the camera angle, which maxes out at 45 degrees by default as this captures the entire scene for the majority of angles. r.Ortho.AutoPlanes.ShiftPlanes should be used to account for views outside of this.
The FarPlane is the required depth precision interpretation for the UnitPerPixelRatio. We clamp this to remove the Near plane difference, and also max out at the previously set maximum FPValue. This setup should help for possible future implementations where we can increase the depth range (i.e. LWC + double float depth buffers).
| void FMinimalViewInfo::BlendViewInfo | ( | FMinimalViewInfo & | OtherInfo, |
| float | OtherWeight | ||
| ) |
| float FMinimalViewInfo::CalculateFirstPersonFOVCorrectionFactor | ( | ) | const |
Correction factor to apply to the first person transform used on primitives tagged as "IsFirstPerson" to achieve a first person specific field of view. It is computed as tan(SceneFOVRadians * 0.5) / tan(FirstPersonFOVRadians * 0.5).
| FMatrix FMinimalViewInfo::CalculateProjectionMatrix | ( | ) | const |
Calculates the projection matrix using this view info's aspect ratio (regardless of bConstrainAspectRatio)
|
static |
Calculates the projection matrix (and potentially a constrained view rectangle) given a FMinimalViewInfo and partially configured projection data (must have the view rect already set)
|
static |
Calculates the projection matrix (and potentially a constrained view rectangle) given a FMinimalViewInfo and partially configured projection data (must have the view rect already set). ConstrainedViewRectangle is only used if the ViewInfo.bConstrainAspectRatio is set.
| void FMinimalViewInfo::ClearOverscan | ( | ) |
Removes all overscan (uniform and asymmetric) from the view info.
| bool FMinimalViewInfo::Equals | ( | const FMinimalViewInfo & | OtherInfo | ) | const |
|
inline |
The near plane distance of the perspective view (in world units). Returns the value of PerspectiveNearClipPlane if positive, and GNearClippingPlane otherwise
|
inline |
Gets the total amount of overscan that has been applied to the view's frustum, with 0.0 meaning no overscan and 1.0 meaning 100% overscan
Sets the camera distance from view target for AutoCalculateOrthoPlanes
| FVector FMinimalViewInfo::TransformWorldToFirstPerson | ( | const FVector & | WorldPosition, |
| bool | bIgnoreFirstPersonScale | ||
| ) | const |
Transforms a world space location into "first person space". This function mirrors the morphing that is applied to first person primitives when they are rendered on the GPU, so it can be used for spawning objects (e.g. projectiles or ejected shell casings) relative to the morphed first person geometry on screen. Setting bIgnoreFirstPersonScale to true only applies the field of view morphing and is useful for cases where a full size projectile is spawned in front of the first person weapon. By ignoring the first person scale for the spawn location, the spawned full-size projectile will be spawned a bit further away from the camera, but its on-screen size will look correct.
| float FMinimalViewInfo::AspectRatio |
| TOptional<EAspectRatioAxisConstraint> FMinimalViewInfo::AspectRatioAxisConstraint |
| FVector4f FMinimalViewInfo::AsymmetricCropFraction |
Experimental: The fraction for each edge between 0.0 and 1.0 of the view to crop to during the final post process upscale, with 1.0 meaning no crop. By convention, X is the left edge, Y is the right edge, Z is the top edge, and W is the bottom edge. Stacks with uniform CropFraction.
| float FMinimalViewInfo::AutoPlaneShift |
Manually adjusts the planes of this camera, maintaining the distance between them. Positive moves out to the farplane, negative towards the near plane
| bool FMinimalViewInfo::bAutoCalculateOrthoPlanes |
Option for the Ortho camera to automatically calculated the near/far plane
| uint32 FMinimalViewInfo::bConstrainAspectRatio |
| bool FMinimalViewInfo::bUpdateOrthoPlanes |
Adjusts the near/far planes and the view origin of the current camera automatically to avoid clipping and light artefacting
| bool FMinimalViewInfo::bUseCameraHeightAsViewTarget |
If UpdateOrthoPlanes is enabled, this setting will use the cameras current height to compensate the distance to the general view (as a pseudo distance to view target when one isn't present)
| uint32 FMinimalViewInfo::bUseFieldOfViewForLOD |
| uint32 FMinimalViewInfo::bUseFirstPersonParameters |
| float FMinimalViewInfo::CropFraction |
The fraction between 0.0 and 1.0 of the view to crop to during the final post process upscale, with 1.0 meaning no crop
| float FMinimalViewInfo::DesiredFOV |
The originally desired horizontal field of view before any adjustments to account for different aspect ratios
| float FMinimalViewInfo::FirstPersonFOV |
The horizontal field of view (in degrees) used for primitives tagged as "IsFirstPerson".
| float FMinimalViewInfo::FirstPersonScale |
The scale to apply to primitives tagged as "IsFirstPerson". This is used to scale down primitives towards the camera such that they are small enough not to intersect with the scene.
| float FMinimalViewInfo::FOV |
The horizontal field of view (in degrees) in perspective mode (ignored in orthographic mode).
| FVector FMinimalViewInfo::Location |
Location
| FVector2D FMinimalViewInfo::OffCenterProjectionOffset |
Off-axis / off-center projection offset as proportion of screen dimensions
| float FMinimalViewInfo::OrthoFarClipPlane |
The far plane distance of the orthographic view (in world units)
| float FMinimalViewInfo::OrthoNearClipPlane |
The near plane distance of the orthographic view (in world units)
| float FMinimalViewInfo::OrthoWidth |
The desired width (in world units) of the orthographic view (ignored in Perspective mode)
| float FMinimalViewInfo::OverscanResolutionFraction |
Resolution fraction that scales with the amount of overscan added to the view
| float FMinimalViewInfo::PerspectiveNearClipPlane |
The near plane distance of the perspective view (in world units). Set to a negative value to use the default global value of GNearClippingPlane
| float FMinimalViewInfo::PostProcessBlendWeight |
Indicates if PostProcessSettings should be applied.
| struct FPostProcessSettings FMinimalViewInfo::PostProcessSettings |
Post-process settings to use if PostProcessBlendWeight is non-zero.
| TOptional<FTransform> FMinimalViewInfo::PreviousViewTransform |
Optional transform to be considered as this view's previous transform
| TEnumAsByte<ECameraProjectionMode::Type> FMinimalViewInfo::ProjectionMode |
| FRotator FMinimalViewInfo::Rotation |
Rotation