FPrimitiveSceneProxy

Encapsulates the data which is mirrored to render a [UPrimitiveComponent](API\Runtime\Engine\Components\UPrimitiveComponent) parallel to the game thread.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/PrimitiveSceneProxy.h

Include

#include "PrimitiveSceneProxy.h"

Syntax

class FPrimitiveSceneProxy

Remarks

Encapsulates the data which is mirrored to render a UPrimitiveComponent parallel to the game thread. This is intended to be subclassed to support different primitive types.

Variables

Name Description

Protected variable

uint8: 1

 

bAffectDistanceFieldLighting

Protected variable

uint8: 1

 

bAffectDynamicIndirectLighting

True if the primitive casts Reflective Shadow Map shadows (meaning it affects Light Propagation Volumes).

Protected variable

uint8: 1

 

bAlwaysHasVelocity

Whether the primitive should always be considered to have velocities, even if it hasn't moved.

Protected variable

uint8: 1

 

bCastCapsuleDirectShadow

Whether the primitive should use capsules for direct shadowing, if present. Forces inset shadows.

Protected variable

uint8: 1

 

bCastCinematicShadow

Whether this component should create a per-object shadow that gives higher effective shadow resolution.

Protected variable

uint8: 1

 

bCastDynamicShadow

True if the primitive casts dynamic shadows.

Protected variable

uint8: 1

 

bCastFarShadow

When enabled, the component will be rendering into the distant shadow cascades (only for directional lights).

Protected variable

uint8: 1

 

bCastHiddenShadow

True if the primitive casts shadows even when hidden.

Protected variable

uint8: 1

 

bCastInsetShadow

Whether this component should create a per-object shadow that gives higher effective shadow resolution.

Protected variable

uint8: 1

 

bCastsDynamicIndirectShadow

Whether the primitive should use an inset indirect shadow from capsules or mesh distance fields.

Protected variable

uint8: 1

 

bCastShadowAsTwoSided

Whether this primitive should cast dynamic shadows as if it were a two sided material.

Protected variable

uint8: 1

 

bCastStaticShadow

True if the primitive casts static shadows.

Protected variable

uint8: 1

 

bCastVolumetricTranslucentShadow

Whether the object should cast a volumetric translucent shadow.

Protected variable

uint8: 1

 

bGoodCandidateForCachedShadowmap

Whether this proxy's mesh is unlikely to be constantly changing.

Protected variable

uint8: 1

 

bHasValidSettingsForStaticLighting

True if the primitive wants to use static lighting, but has invalid content settings to do so.

Protected variable

uint8: 1

 

bLightAttachmentsAsGroup

Whether to light this component and any attachments as a group.

Protected variable

uint8: 1

 

bNeedsLevelAddedToWorldNotification

Whether this primitive requires notification when its level is added to the world and made visible for the first time.

Protected variable

uint8: 1

 

bNeedsUnbuiltPreviewLighting

Whether the primitive should be statically lit but has unbuilt lighting, and a preview should be used.

Protected variable

uint8: 1

 

bSelfShadowOnly

When enabled, the component will only cast a shadow on itself and not other components in the world.

Protected variable

uint8: 1

 

bSingleSampleShadowFromStationaryLights

Whether the whole component should be shadowed as one from stationary lights, which makes shadow receiving much cheaper.

Protected variable

uint8: 1

 

bStaticElementsAlwaysUseProxyPrimitiveUniformBuffer

Whether this proxy always uses UniformBuffer and no other uniform buffers.

Protected variable

uint8: 1

 

bSupportsDistanceFieldRepresentation

Whether the primitive type supports a distance field representation.

Protected variable

uint8: 1

 

bSupportsHeightfieldRepresentation

Whether the primitive implements GetHeightfieldRepresentation()

Protected variable

uint8: 1

 

bVerifyUsedMaterials

Protected variable

uint8: 1

 

bVFRequiresPrimitiveUniformBuffer

Whether this proxy ever draws with vertex factories that require a primitive uniform buffer.

Protected variable

uint8: 1

 

bWantsSelectionOutline

True by default, if set to false will make given proxy never drawn with selection outline

Protected variable

uint8: 1

 

bWillEverBeLit

Can be set to false to skip some work only needed on lit primitives.

Public variable

TArray< FDebugM...

 

DebugMassData

Protected variable

float

 

DistanceFieldSelfShadowBias

Protected variable

float

 

DynamicIndirectShadowMinVisibility

Min visibility for capsule shadows.

Protected variable

TEnumAsByte< EI...

 

IndirectLightingCacheQuality

Quality of interpolated indirect lighting for Movable components.

Protected variable

float

 

LpvBiasMultiplier

The bias applied to LPV injection

Protected variable

TArray< ERuntim...

 

RuntimeVirtualTextureMaterialTypes

Set of unique runtime virtual texture material types referenced by RuntimeVirtualTextures.

Protected variable

TArray< URuntim...

 

RuntimeVirtualTextures

Array of runtime virtual textures that this proxy should render to.

Protected variable

int8

 

VirtualTextureCullMips

Number of low mips to skip when rendering to runtime virtual texture.

Protected variable

int8

 

VirtualTextureLodBias

Geometry Lod bias when rendering to runtime virtual texture.

Protected variable

int8

 

VirtualTextureMinCoverage

Log2 of minimum estimated pixel coverage before culling from runtime virtual texture.

Constructors

Name Description

Public function

FPrimitiveSceneProxy

(
    const UPrimitiveComponent* InC...,
    FName ResourceName
)

Initialization constructor.

Destructors

Name Description

Public function Virtual

~FPrimitiveSceneProxy()

Virtual destructor.

Functions

Name Description

Public function Virtual

void

 

AcceptOcclusionResults

(
    const FSceneView* View,
    TArray< bool >* Results,
    int32 ResultsStart,
    int32 NumResults
)

Gives the primitive the results of sub-occlusion-queries

Public function Const

bool

 

AffectsDistanceFieldLighting()

Public function Const

bool

 

AffectsDynamicIndirectLighting()

Public function Const

bool

 

AllowApproximateOcclusion()

Public function Const

bool

 

AlwaysHasVelocity()

Public function Virtual

void

 

ApplyLateUpdateTransform

(
    const FMatrix& LateUpdateTransform
)

Applies a "late in the frame" adjustment to the proxy's existing transform

Public function Virtual

void

 

ApplyWorldOffset

(
    FVector InOffset
)

Shifts primitive position and all relevant data by an arbitrary delta.

Public function Virtual Const

bool

 

CanBeOccluded()

Public function Const

bool

 

CastsCapsuleDirectShadow()

Public function Const

bool

 

CastsCinematicShadow()

Public function Const

bool

 

CastsDynamicIndirectShadow()

Public function Const

bool

 

CastsDynamicShadow()

Public function Const

bool

 

CastsFarShadow()

Public function Const

bool

 

CastsHiddenShadow()

Public function Const

bool

 

CastsInsetShadow()

Public function Const

bool

 

CastsSelfShadowOnly()

Public function Const

bool

 

CastsShadowAsTwoSided()

Public function Const

bool

 

CastsStaticShadow()

Public function Const

bool

 

CastsVolumetricTranslucentShadow()

Public function Virtual Const

int32

 

CollectOccluderElements

(
    FOccluderElementsCollector& Collec...
)

Collects occluder geometry for software occlusion culling

Public function Virtual

HHitProxy &#...

 

CreateHitProxies

(
    UPrimitiveComponent* Component,
    TArray< TRefCountPtr< HHitProxy > >...
)

Creates the hit proxies are used when DrawDynamicElements is called. Called in the game thread.

Public function Virtual

void

 

CreateRenderThreadResources()

Called when the rendering thread adds the proxy to the scene.

Public function Virtual

void

 

DestroyRenderThreadResources()

Called when the rendering thread removes the proxy from the scene.

Public function Const

bool

 

DoesVFRequirePrimitiveUniformBuffer()

Public function Static

void

 

DrawArc

(
    FPrimitiveDrawInterface* PDI,
    const FVector& Start,
    const FVector& End,
    const float Height,
    const uint32 Segments,
    const FLinearColor& Color,
    uint8 DepthPriorityGroup,
    const float Thickness,
    const bool bScreenSpace
)

Drawing helper. Draws nice bouncy line.

Public function Static

void

 

DrawArrowHead

(
    FPrimitiveDrawInterface* PDI,
    const FVector& Tip,
    const FVector& Origin,
    const float Size,
    const FLinearColor& Color,
    uint8 DepthPriorityGroup,
    const float Thickness,
    const bool bScreenSpace
)

Public function Virtual

void

 

DrawStaticElements

Draws the primitive's static elements.

Public function Const

bool

 

DrawsVelocity()

Returns whether draws velocity in base pass.

Public function Virtual Const

void

 

GatherSimpleLights

(
    const FSceneViewFamily& ViewFamily,
    FSimpleLightArray& OutParticleLigh...
)

Callback from the renderer to gather simple lights that this proxy wants renderered.

Public function Const

const FVecto...

 

GetActorPosition()

Public function Const

uint32

 

GetAllocatedSize()

Public function Const

const FBoxSp...

 

GetBounds()

Public function Virtual Const

uint8

 

GetCurrentFirstLODIdx_RenderThread()

Public function Const

uint8

 

GetCustomDepthStencilValue()

Public function Virtual Const

const FColor...

 

GetCustomHitProxyIdBuffer()

Allows a scene proxy to override hit proxy ids and generate more than one hit proxy id per draw call Useful for sub-section selection (faces, vertices, bones, etc)

Public function Virtual Const

FBoxSphereBo...

 

GetCustomOcclusionBounds()

Return the custom occlusion bounds for this scene proxy.

Public function Const

const FCusto...

 

GetCustomPrimitiveData()

Get the custom primitive data for this scene proxy.

Public function Const

uint8

 

GetDepthPriorityGroup

(
    const FSceneView* View
)

Determines the DPG to render the primitive in for the given view.

Public function Virtual Const

void

 

GetDistancefieldAtlasData

(
    FBox& LocalVolumeBounds,
    FVector2D& OutDistanceMinMax,
    FIntVector& OutBlockMin,
    FIntVector& OutBlockSize,
    bool& bOutBuiltAsIfTwoSided,
    bool& bMeshWasPlane,
    float& SelfShadowBias,
    TArray< FMatrix >& ObjectLocalToWo...,
    bool& bOutThrottled
)

Public function Virtual Const

void

 

GetDistanceFieldInstanceInfo

(
    int32& NumInstances,
    float& BoundsSurfaceArea
)

Public function Const

float

 

GetDynamicIndirectShadowMinVisibility()

Public function Virtual Const

void

 

GetDynamicMeshElements

(
    const TArray< const FSceneView*...,
    const FSceneViewFamily& ViewFamily,
    uint32 VisibilityMap,
    FMeshElementCollector& Collector
)

Gathers the primitive's dynamic mesh elements.

Public function Virtual

void

 

GetHeightfieldRepresentation

(
    UTexture2D*& OutHeightmapTextu...,
    UTexture2D*& OutDiffuseColorTe...,
    UTexture2D*& OutVisibilityText...,
    FHeightfieldComponentDescription& ...
)

Public function Const

EIndirectLig...

 

GetIndirectLightingCacheQuality()

Public function Virtual

void

 

GetLCIs

(
    FLCIArray& LCIs
)

Public function Const

FLinearColor

 

GetLevelColor()

Public function Const

FName

 

GetLevelName()

Public function Const

uint8

 

GetLightingChannelMask()

Public function Const

uint8

 

GetLightingChannelStencilValue()

Public function Virtual Const

int32

 

GetLightMapResolution()

Get the lightmap resolution for this primitive. Used in VMI_LightmapDensity.

Public function Const

ELightmapTyp...

 

GetLightmapType()

Public function Virtual Const

void

 

GetLightRelevance

(
    const FLightSceneProxy* LightS...,
    bool& bDynamic,
    bool& bRelevant,
    bool& bLightMapped,
    bool& bShadowMapped
)

Determines the relevance of this primitive's elements to the given light.

Public function Const

const FBoxSp...

 

GetLocalBounds()

Public function Const

const FMatri...

 

GetLocalToWorld()

Public function Virtual Const

int32

 

GetLOD

(
    const FSceneView* View
)

Returns the LOD that the primitive will render at for this view.

Public function Const

float

 

GetLpvBiasMultiplier()

Public function Virtual Const

bool

 

GetMaterialTextureScales

(
    int32 LODIndex,
    int32 SectionIndex,
    const FMaterialRenderProxy* Ma...,
    FVector4* OneOverScales,
    FIntVector4* UVChannelIndices
)

Get mesh UV density for a LOD-section.

Public function Const

float

 

GetMaxDrawDistance()

Public function Const

uint32

 

GetMemoryFootprint()

Every derived class should override these functions

Public function Virtual Const

void

 

GetMeshDescription

(
    int32 LODIndex,
    TArray< FMeshBatch >& OutMeshEleme...
)

Gathers a description of the mesh elements to be rendered for the given LOD index, without consideration for views.

Public function Virtual Const

bool

 

GetMeshUVDensities

(
    int32 LODIndex,
    int32 SectionIndex,
    FVector4& WorldUVDensities
)

Get mesh UV density for a LOD-section.

Public function Const

float

 

GetMinDrawDistance()

Public function

int32

 

GetNumUncachedStaticLightingInteractions()

Public function Virtual Const

const TArray...

 

GetOcclusionQueries

(
    const FSceneView* View
)

Gets the boxes for sub occlusion queries

Public function Const

FName

 

GetOwnerName()

Public function Virtual Const

void

 

GetPreSkinnedLocalBounds

(
    FBoxSphereBounds& OutBounds
)

Public function Const

FPrimitiveCo...

 

GetPrimitiveComponentId()

Public function Virtual Const

bool

 

GetPrimitiveDistance

(
    int32 LODIndex,
    int32 SectionIndex,
    const FVector& ViewOrigin,
    float& PrimitiveDistance
)

Get primitive distance to view origin for a given LOD-section.

Public function Const

FPrimitiveSc...

 

GetPrimitiveSceneInfo()

Public function Const

FLinearColor

 

GetPropertyColor()

Public function Const

FName

 

GetResourceName()

Public function Const

FSceneInterf...

 

GetScene()

Accessors.

Public function Virtual Const

void

 

GetShadowShapes

(
    TArray< FCapsuleShape >& CapsuleSh...
)

Gathers shadow shapes from this proxy.

Public function Virtual Const

uint8

 

GetStaticDepthPriorityGroup()

Determines the DPG to render the primitive in regardless of view.

Public function Const

TStatId

 

GetStatId()

Public function Const

EStencilMask

 

GetStencilWriteMask()

Public function Const

int16

 

GetTranslucencySortPriority()

Public function Const

SIZE_T

 

GetTypeHash()

Return a type (or subtype) specific hash for sorting purposes

Public function Const

FRHIUniformB...

 

GetUniformBuffer()

Public function Virtual Const

FPrimitiveVi...

 

GetViewRelevance

(
    const FSceneView* View
)

Determines the relevance of this primitive's elements to the given view.

Public function Const

int32

 

GetVirtualTextureCullMips()

Public function Const

int32

 

GetVirtualTextureLodBias()

Public function Const

int32

 

GetVirtualTextureMinCoverage()

Public function Const

int32

 

GetVisibilityId()

Public function Const

FLinearColor

 

GetWireframeColor()

Public function Virtual Const

bool

 

HasCustomOcclusionBounds()

Returns whether the proxy utilizes custom occlusion bounds or not

Public function Virtual Const

bool

 

HasDistanceFieldRepresentation()

Public function Virtual Const

bool

 

HasDynamicIndirectShadowCasterRepresentation()

Public function Const

bool

 

HasMotionBlurVelocityMeshes()

Public function Const

bool

 

HasPerInstanceHitProxies()

Public function Const

bool

 

HasStaticLighting()

Public function Virtual Const

bool

 

HasSubprimitiveOcclusionQueries()

Public function Const

bool

 

HasValidSettingsForStaticLighting()

Public function Const

bool

 

HasViewDependentDPG()

Public function Virtual Const

bool

 

HeightfieldHasPendingStreaming()

Public function Const

bool

 

IsCollisionEnabled()

Public function Const

bool

 

IsComponentLevelVisible()

Public function Virtual Const

bool

 

IsDetailMesh()

Returns whether this proxy should be considered a "detail mesh".

Public function Virtual Const

bool

 

IsDrawnInGame()

Tell us if this proxy is drawn in game.

Public function Const

bool

 

IsHovered()

Public function Const

bool

 

IsIndividuallySelected()

Public function Const

bool

 

IsLocalToWorldDeterminantNegative()

Public function Const

bool

 

IsMeshShapeOftenMoving()

Public function Const

bool

 

IsMovable()

Public function Const

bool

 

IsOftenMoving()

Public function Const

bool

 

IsOwnedBy

(
    const AActor* Actor
)

Public function Const

bool

 

IsParentSelected()

Public function Const

bool

 

IsSelectable()

Public function Const

bool

 

IsSelected()

Public function Const

bool

 

IsShadowCast

(
    const FSceneView* View
)

Public function Const

bool

 

IsShown

(
    const FSceneView* View
)

Public function Const

bool

 

IsStatic()

Public function Const

bool

 

IsStaticPathAvailable()

Public function Virtual Const

bool

 

IsUsingCustomLODRules()

Tell us if we should rely on the default LOD computing rules or not.

Public function Virtual Const

bool

 

IsUsingDistanceCullFade()

Public function Const

bool

 

IsVisibleInRayTracing()

Public function Const

bool

 

IsVisibleInReflectionCaptures()

Public function Const

bool

 

LightAttachmentsAsGroup()

Public function Const

bool

 

NeedsLevelAddedToWorldNotification()

Public function Const

bool

 

NeedsUnbuiltPreviewLighting()

Public function Virtual

void

 

OnDetachLight

(
    const FLightSceneInfo* Light
)

Called by the rendering thread to notify the proxy when a light is no longer associated with the proxy, so that it can clean up any cached resources.

Public function Virtual

void

 

OnLevelAddedToWorld()

Called to notify the proxy that the level has been fully added to the world and the primitive will now be rendered.

Public function Virtual

void

 

OnTransformChanged()

Called to notify the proxy when its transform has been updated.

Protected function

void

 

OverrideOwnerName

(
    FName InOwnerName
)

Allow subclasses to override the primitive name. Used primarily by BSP.

Public function Const

const bool

 

ReceivesDecals()

Public function Const

void

 

RenderBounds

(
    FPrimitiveDrawInterface* PDI,
    const FEngineShowFlags& EngineShow...,
    const FBoxSphereBounds& Bounds,
    bool bRenderInEditor
)

Helper for components that want to render bounds.

Public function

void

 

SetCollisionEnabled_GameThread

(
    const bool bNewEnabled
)

Set the collision flag on the scene proxy to enable/disable collision drawing

Public function

void

 

SetCollisionEnabled_RenderThread

(
    const bool bNewEnabled
)

Set the collision flag on the scene proxy to enable/disable collision drawing (RENDER THREAD)

Public function

void

 

SetCustomDepthEnabled_GameThread

(
    const bool bInRenderCustomDepth
)

Set the custom depth enabled flag

Public function

void

 

SetCustomDepthEnabled_RenderThread

(
    const bool bInRenderCustomDepth
)

Set the custom depth enabled flag (RENDER THREAD)

Public function

void

 

SetCustomDepthStencilValue_GameThread

(
    const int32 InCustomDepthStencilVal...
)

Set the custom depth stencil value

Public function

void

 

SetCustomDepthStencilValue_RenderThread

(
    const int32 InCustomDepthStencilVal...
)

Set the custom depth stencil value (RENDER THREAD)

Public function Virtual

void

 

SetDebugMassData

(
    const TArray< FDebugMassData >& In...
)

Sets the primitive proxy's mass space to component space.

Public function

void

 

SetDistanceFieldSelfShadowBias_RenderThread

(
    float NewBias
)

Public function

void

 

SetHiddenEdViews_GameThread

(
    uint64 InHiddenEditorViews
)

Updates the hidden editor view visibility map on the game thread which just enqueues a command on the render thread

Public function

void

 

SetHovered_GameThread

(
    const bool bInHovered
)

Updates hover state for the primitive proxy.

Protected function

void

 

SetHovered_RenderThread

(
    const bool bInHovered
)

Updates hover state for the primitive proxy.

Public function

void

 

SetLevelColor

(
    const FLinearColor& InLevelColor
)

Public function

void

 

SetLightingChannels_GameThread

(
    FLightingChannels LightingChannels
)

Updates the lighting channels for the primitive proxy.

Public function

void

 

SetPropertyColor

(
    const FLinearColor& InPropertyColo...
)

Public function

void

 

SetSelection_GameThread

(
    const bool bInParentSelected,
    const bool bInIndividuallySelected
)

Updates selection for the primitive proxy.

Protected function

void

 

SetSelection_RenderThread

(
    const bool bInParentSelected,
    const bool bInIndividuallySelected
)

Updates selection for the primitive proxy.

Public function

void

 

SetUsedMaterialForVerification

(
    const TArray< UMaterialInterface&#...
)

This function exist only to perform an update of the UsedMaterialsForVerification on the render thread

Public function

void

 

SetWireframeColor

(
    const FLinearColor& InWireframeCol...
)

Public function Const

bool

 

ShouldReceiveMobileCSMShadows()

Public function Const

bool

 

ShouldRenderCustomDepth()

Public function Const

bool

 

ShouldRenderInDepthPass()

Public function Const

bool

 

ShouldRenderInMainPass()

Public function Const

bool

 

ShouldUseAsOccluder()

Public function Virtual Const

bool

 

ShowInBSPSplitViewmode()

Public function Const

bool

 

StaticElementsAlwaysUseProxyPrimitiveUniformBuffer()

Public function Const

bool

 

SupportsDistanceFieldRepresentation()

Public function Const

bool

 

SupportsHeightfieldRepresentation()

Public function Const

bool

 

TreatAsBackgroundForOcclusion()

Public function

void

 

UpdateUniformBuffer()

Updates the primitive proxy's uniform buffer.

Public function Const

bool

 

UseEditorCompositing

(
    const FSceneView* View
)

Public function Const

bool

 

UseSingleSampleShadowFromStationaryLights()

Public function Const

void

 

VerifyUsedMaterial

(
    const FMaterialRenderProxy* Ma...
)

Verifies that a material used for rendering was present in the component's GetUsedMaterials list.

Public function Const

bool

 

WantsSelectionOutline()

Public function Const

bool

 

WillEverBeLit()

Public function Const

bool

 

WritesVirtualTexture()

Public function Const

bool

 

WritesVirtualTexture

(
    URuntimeVirtualTexture* Virtua...
)

Classes

Name

Description

Public struct

FDebugMassData

Typedefs

Name

Description

FLCIArray

Get the list of LCIs.

Deprecated Functions

Name Description

Public function Virtual Const

FLODMask

 

GetCustomLOD

(
    const FSceneView& InView,
    float InViewLODScale,
    int32 InForcedLODLevel,
    float& OutScreenSizeSquared
)

We no longer support custom LOD rules.

Public function Virtual Const

FLODMask

 

GetCustomWholeSceneShadowLOD

(
    const FSceneView& InView,
    float InViewLODScale,
    int32 InForcedLODLevel,
    const FLODMask& InVisibilePrimitiv...,
    float InShadowMapTextureResolution,
    float InShadowMapCascadeSize,
    int8 InShadowCascadeId,
    bool InHasSelfShadow
)

We no longer support custom shadow LOD rules.

Public function Virtual

void *

 

InitViewCustomData

(
    const FSceneView& InView,
    float InViewLODScale,
    FMemStackBase& InCustomDataMemStac...,
    bool InIsStaticRelevant,
    bool InIsShadowOnly,
    const FLODMask* InVisiblePrimi...,
    float InMeshScreenSizeSquared
)

The entire ViewCustomData is deprecated. You need to reimplement your feature in other ways, like IPersistentViewUniformBufferExtension (use landscape as an example).

Public function Virtual Const

bool

 

IsUsingCustomWholeSceneShadowLODRules()

We no longer support custom LOD rules.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss