UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FVirtualShadowMapClipmap Class Reference

#include <VirtualShadowMapClipmap.h>

+ Inheritance diagram for FVirtualShadowMapClipmap:

Public Member Functions

 FVirtualShadowMapClipmap (FVirtualShadowMapArray &VirtualShadowMapArray, const FLightSceneInfo &InLightSceneInfo, const FViewMatrices &CameraViewMatrices, FIntPoint CameraViewRectSize, const FViewInfo *InDependentView, float LightMobilityFactor, const FVirtualShadowMapClipmapConfig &Config=FVirtualShadowMapClipmapConfig::GetGlobal())
 
FViewMatrices GetViewMatrices (int32 ClipmapIndex) const
 
FVector2f GetDynamicDepthCullRange (int32 ClipmapIndex) const
 
int32 GetVirtualShadowMapId () const
 
int32 GetLevelCount () const
 
int32 GetClipmapLevel (int32 ClipmapIndex) const
 
FVector GetPreViewTranslation (int32 ClipmapIndex) const
 
FMatrix GetViewToClipMatrix (int32 ClipmapIndex) const
 
FMatrix GetWorldToLightViewRotationMatrix () const
 
const FLightSceneInfoGetLightSceneInfo () const
 
const FVirtualShadowMapProjectionShaderDataGetProjectionShaderData (int32 ClipmapIndex) const
 
FVector GetWorldOrigin () const
 
float GetMaxRadius () const
 
FSphere GetBoundingSphere () const
 
FConvexVolume GetViewFrustumBounds () const
 
const FViewInfoGetDependentView () const
 
void OnPrimitiveRendered (const FPrimitiveSceneInfo *PrimitiveSceneInfo)
 
void UpdateCachedFrameData ()
 
TSharedPtr< FVirtualShadowMapPerLightCacheEntry > & GetCacheEntry ()
 
bool IsFirstPersonShadow () const
 

Static Public Member Functions

static float GetLevelRadius (float AbsoluteLevel)
 

Constructor & Destructor Documentation

◆ FVirtualShadowMapClipmap()

FVirtualShadowMapClipmap::FVirtualShadowMapClipmap ( FVirtualShadowMapArray VirtualShadowMapArray,
const FLightSceneInfo InLightSceneInfo,
const FViewMatrices CameraViewMatrices,
FIntPoint  CameraViewRectSize,
const FViewInfo InDependentView,
float  LightMobilityFactor,
const FVirtualShadowMapClipmapConfig Config = FVirtualShadowMapClipmapConfig::GetGlobal() 
)

Orthographic cameras have uniform depth, so basing the LodScale on the width alone can cause issues when selecting the clipmap area to resolve at larger scale views. Instead we use the OrthoWidth. This gives a larger area for the shadows to be drawn to and ensures shadows further away/in the corners of the view rect have the correct LOD resolution. We default to the viewport as a minimum.

If enabled, use the ViewTarget location as the WorldOrigin location, this helps with scaling VSMs in Ortho as the clipmaps emanate more evenly from the focus of the view. A ViewTarget is not always necessarily present, but there isn't really an alternative way to estimate the best WorldOrigin for this effect to work well right now without the ViewTarget set.

For Ortho projections, this branch bases the first level VSM on the set OrthoWidth. This reduces the number of clipmaps generated and also scales the precision of the clipmaps depending on the scene.

To be on the safe side, we output -1 FirstLevel compared to what the full OrthoWidth would output. The InvProjectionMatrix outputs half the OrthoWidth in the [0][0] position, and as we are using Log2, we can just use that raw value, rather than multiplying it then subtracting a level.

Member Function Documentation

◆ GetBoundingSphere()

FSphere FVirtualShadowMapClipmap::GetBoundingSphere ( ) const
inline

◆ GetCacheEntry()

TSharedPtr< FVirtualShadowMapPerLightCacheEntry > & FVirtualShadowMapClipmap::GetCacheEntry ( )
inline

◆ GetClipmapLevel()

int32 FVirtualShadowMapClipmap::GetClipmapLevel ( int32  ClipmapIndex) const
inline

◆ GetDependentView()

const FViewInfo * FVirtualShadowMapClipmap::GetDependentView ( ) const
inline

◆ GetDynamicDepthCullRange()

FVector2f FVirtualShadowMapClipmap::GetDynamicDepthCullRange ( int32  ClipmapIndex) const
inline

◆ GetLevelCount()

int32 FVirtualShadowMapClipmap::GetLevelCount ( ) const
inline

◆ GetLevelRadius()

float FVirtualShadowMapClipmap::GetLevelRadius ( float  AbsoluteLevel)
static

◆ GetLightSceneInfo()

const FLightSceneInfo & FVirtualShadowMapClipmap::GetLightSceneInfo ( ) const
inline

◆ GetMaxRadius()

float FVirtualShadowMapClipmap::GetMaxRadius ( ) const

◆ GetPreViewTranslation()

FVector FVirtualShadowMapClipmap::GetPreViewTranslation ( int32  ClipmapIndex) const
inline

◆ GetProjectionShaderData()

const FVirtualShadowMapProjectionShaderData & FVirtualShadowMapClipmap::GetProjectionShaderData ( int32  ClipmapIndex) const

◆ GetViewFrustumBounds()

FConvexVolume FVirtualShadowMapClipmap::GetViewFrustumBounds ( ) const
inline

◆ GetViewMatrices()

FViewMatrices FVirtualShadowMapClipmap::GetViewMatrices ( int32  ClipmapIndex) const

◆ GetViewToClipMatrix()

FMatrix FVirtualShadowMapClipmap::GetViewToClipMatrix ( int32  ClipmapIndex) const
inline

◆ GetVirtualShadowMapId()

int32 FVirtualShadowMapClipmap::GetVirtualShadowMapId ( ) const
inline

◆ GetWorldOrigin()

FVector FVirtualShadowMapClipmap::GetWorldOrigin ( ) const
inline

◆ GetWorldToLightViewRotationMatrix()

FMatrix FVirtualShadowMapClipmap::GetWorldToLightViewRotationMatrix ( ) const
inline

◆ IsFirstPersonShadow()

bool FVirtualShadowMapClipmap::IsFirstPersonShadow ( ) const
inline

Whether the clipmap is for casting shadow of FirstPersonWorldSpaceRepresentation primitives onto the scene.

◆ OnPrimitiveRendered()

void FVirtualShadowMapClipmap::OnPrimitiveRendered ( const FPrimitiveSceneInfo PrimitiveSceneInfo)

Called when a primitive passes CPU-culling, note that this applies to non-nanite primitives only. Not thread safe in general.

◆ UpdateCachedFrameData()

void FVirtualShadowMapClipmap::UpdateCachedFrameData ( )

Called to push any cache data to cache entry at the end of the frame.


The documentation for this class was generated from the following files: