Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::Render::ProjectedShadowFeatureProcessor Class Referencefinal

#include <ProjectedShadowFeatureProcessor.h>

Inherits AZ::Render::ProjectedShadowFeatureProcessorInterface.

Public Member Functions

 AZ_RTTI (AZ::Render::ProjectedShadowFeatureProcessor, "{02AFA06D-8B37-4D47-91BD-849CAC7FB330}", AZ::Render::ProjectedShadowFeatureProcessorInterface)
 
void Activate () override
 Perform any necessary activation and gives access to owning Scene.
 
void Deactivate () override
 Perform any necessary deactivation.
 
void Simulate (const SimulatePacket &packet) override
 
void PrepareViews (const PrepareViewsPacket &, AZStd::vector< AZStd::pair< RPI::PipelineViewTag, RPI::ViewPtr > > &) override
 
void Render (const RenderPacket &packet) override
 
ShadowId AcquireShadow () override
 Creates a new projected shadow and returns a handle that can be used to reference it later.
 
void ReleaseShadow (ShadowId id) override
 Releases a projected shadow given its ID.
 
void SetShadowTransform (ShadowId id, Transform transform) override
 Sets the world space transform of where the shadow is cast from.
 
void SetNearFarPlanes (ShadowId id, float nearPlaneDistance, float farPlaneDistance) override
 Sets the near and far plane distances for the shadow.
 
void SetAspectRatio (ShadowId id, float aspectRatio) override
 Sets the aspect ratio for the shadow.
 
void SetFieldOfViewY (ShadowId id, float fieldOfViewYRadians) override
 Sets the field of view for the shadow in radians in the Y direction.
 
void SetShadowmapMaxResolution (ShadowId id, ShadowmapSize size) override
 Sets the maximum resolution of the shadow map.
 
void SetShadowBias (ShadowId id, float bias) override
 Sets the shadow bias.
 
void SetNormalShadowBias (ShadowId id, float normalShadowBias) override
 Sets the normal shadow bias.
 
void SetShadowFilterMethod (ShadowId id, ShadowFilterMethod method) override
 Sets the shadow filter method.
 
void SetFilteringSampleCount (ShadowId id, uint16_t count) override
 Sets the sample count for filtering of the shadow boundary, max 64.
 
void SetUseCachedShadows (ShadowId id, bool useCachedShadows) override
 
void SetShadowProperties (ShadowId id, const ProjectedShadowDescriptor &descriptor) override
 Sets all of the shadow properties in one call.
 
const ProjectedShadowDescriptorGetShadowProperties (ShadowId id) override
 Gets the current shadow properties. Useful for updating several properties at once in SetShadowProperties() without having to set every property.
 
void SetEsmExponent (ShadowId id, float exponent)
 
- Public Member Functions inherited from AZ::Render::ProjectedShadowFeatureProcessorInterface
 AZ_RTTI (AZ::Render::ProjectedShadowFeatureProcessorInterface, "{C5651D73-3448-4D76-91C0-0E636A197F63}", AZ::RPI::FeatureProcessor)
 
virtual ShadowId AcquireShadow ()=0
 Creates a new projected shadow and returns a handle that can be used to reference it later.
 
virtual void ReleaseShadow (ShadowId id)=0
 Releases a projected shadow given its ID.
 
virtual void SetShadowTransform (ShadowId id, Transform transform)=0
 Sets the world space transform of where the shadow is cast from.
 
virtual void SetNearFarPlanes (ShadowId id, float nearPlaneDistance, float farPlaneDistance)=0
 Sets the near and far plane distances for the shadow.
 
virtual void SetAspectRatio (ShadowId id, float aspectRatio)=0
 Sets the aspect ratio for the shadow.
 
virtual void SetFieldOfViewY (ShadowId id, float fieldOfView)=0
 Sets the field of view for the shadow in radians in the Y direction.
 
virtual void SetShadowmapMaxResolution (ShadowId id, ShadowmapSize size)=0
 Sets the maximum resolution of the shadow map.
 
virtual void SetShadowBias (ShadowId id, float bias)=0
 Sets the shadow bias.
 
virtual void SetNormalShadowBias (ShadowId id, float normalShadowBias)=0
 Sets the normal shadow bias.
 
virtual void SetShadowFilterMethod (ShadowId id, ShadowFilterMethod method)=0
 Sets the shadow filter method.
 
virtual void SetFilteringSampleCount (ShadowId id, uint16_t count)=0
 Sets the sample count for filtering of the shadow boundary, max 64.
 
virtual void SetUseCachedShadows (ShadowId id, bool useCachedShadows)=0
 
virtual void SetShadowProperties (ShadowId id, const ProjectedShadowDescriptor &descriptor)=0
 Sets all of the shadow properties in one call.
 
virtual const ProjectedShadowDescriptorGetShadowProperties (ShadowId id)=0
 Gets the current shadow properties. Useful for updating several properties at once in SetShadowProperties() without having to set every property.
 
- Public Member Functions inherited from AZ::RPI::FeatureProcessor
 AZ_RTTI (FeatureProcessor, "{B8027170-C65C-4237-964D-B557FC9D7575}")
 
 AZ_CLASS_ALLOCATOR (FeatureProcessor, AZ::SystemAllocator)
 
SceneGetParentScene () const
 
virtual void Activate ()
 Perform any necessary activation and gives access to owning Scene.
 
virtual void Deactivate ()
 Perform any necessary deactivation.
 
virtual void ApplyRenderPipelineChange (RenderPipeline *pipeline)
 
virtual void AddRenderPasses (RenderPipeline *pipeline)
 
virtual void PrepareViews (const PrepareViewsPacket &, AZStd::vector< AZStd::pair< PipelineViewTag, ViewPtr > > &)
 
virtual void Simulate (const SimulatePacket &)
 
virtual void Render (const RenderPacket &)
 
virtual void OnEndCulling (const RenderPacket &)
 
virtual void OnRenderEnd ()
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 

Additional Inherited Members

- Public Types inherited from AZ::Render::ProjectedShadowFeatureProcessorInterface
using ShadowId = RHI::Handle< uint16_t, ProjectedShadowFeatureProcessorInterface >
 
- Static Public Attributes inherited from AZ::Render::ProjectedShadowFeatureProcessorInterface
static constexpr float MaxProjectedShadowRadians = AZ::DegToRad(150.0f)
 
- Protected Member Functions inherited from AZ::RPI::FeatureProcessor
void EnableSceneNotification ()
 
void DisableSceneNotification ()
 

Detailed Description

This feature processor handles creation of shadow passes and manages shadow related data. Use AcquireShadow() to create a new shadow. The ID that is returned from AcquireShadow() corresponds to an index in the m_projectedShadows and m_projectedFilterParams buffers in the View SRG.

Member Function Documentation

◆ AcquireShadow()

ShadowId AZ::Render::ProjectedShadowFeatureProcessor::AcquireShadow ( )
overridevirtual

Creates a new projected shadow and returns a handle that can be used to reference it later.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ Activate()

void AZ::Render::ProjectedShadowFeatureProcessor::Activate ( )
overridevirtual

Perform any necessary activation and gives access to owning Scene.

Reimplemented from AZ::RPI::FeatureProcessor.

◆ Deactivate()

void AZ::Render::ProjectedShadowFeatureProcessor::Deactivate ( )
overridevirtual

Perform any necessary deactivation.

Reimplemented from AZ::RPI::FeatureProcessor.

◆ GetShadowProperties()

const ProjectedShadowDescriptor & AZ::Render::ProjectedShadowFeatureProcessor::GetShadowProperties ( ShadowId  id)
overridevirtual

Gets the current shadow properties. Useful for updating several properties at once in SetShadowProperties() without having to set every property.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ ReleaseShadow()

void AZ::Render::ProjectedShadowFeatureProcessor::ReleaseShadow ( ShadowId  id)
overridevirtual

Releases a projected shadow given its ID.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ Render()

void AZ::Render::ProjectedShadowFeatureProcessor::Render ( const RenderPacket )
overridevirtual

The feature processor should enqueue draw packets to relevant draw lists.

  • This is called every frame.
  • This may be called in parallel with other feature processors.
  • This may be called in parallel with culling

Reimplemented from AZ::RPI::FeatureProcessor.

◆ SetAspectRatio()

void AZ::Render::ProjectedShadowFeatureProcessor::SetAspectRatio ( ShadowId  id,
float  aspectRatio 
)
overridevirtual

Sets the aspect ratio for the shadow.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetFieldOfViewY()

void AZ::Render::ProjectedShadowFeatureProcessor::SetFieldOfViewY ( ShadowId  id,
float  fieldOfView 
)
overridevirtual

Sets the field of view for the shadow in radians in the Y direction.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetFilteringSampleCount()

void AZ::Render::ProjectedShadowFeatureProcessor::SetFilteringSampleCount ( ShadowId  id,
uint16_t  count 
)
overridevirtual

Sets the sample count for filtering of the shadow boundary, max 64.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetNearFarPlanes()

void AZ::Render::ProjectedShadowFeatureProcessor::SetNearFarPlanes ( ShadowId  id,
float  nearPlaneDistance,
float  farPlaneDistance 
)
overridevirtual

Sets the near and far plane distances for the shadow.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetNormalShadowBias()

void AZ::Render::ProjectedShadowFeatureProcessor::SetNormalShadowBias ( ShadowId  id,
float  normalShadowBias 
)
overridevirtual

Sets the normal shadow bias.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetShadowBias()

void AZ::Render::ProjectedShadowFeatureProcessor::SetShadowBias ( ShadowId  id,
float  bias 
)
overridevirtual

Sets the shadow bias.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetShadowFilterMethod()

void AZ::Render::ProjectedShadowFeatureProcessor::SetShadowFilterMethod ( ShadowId  id,
ShadowFilterMethod  method 
)
overridevirtual

Sets the shadow filter method.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetShadowmapMaxResolution()

void AZ::Render::ProjectedShadowFeatureProcessor::SetShadowmapMaxResolution ( ShadowId  id,
ShadowmapSize  size 
)
overridevirtual

Sets the maximum resolution of the shadow map.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetShadowProperties()

void AZ::Render::ProjectedShadowFeatureProcessor::SetShadowProperties ( ShadowId  id,
const ProjectedShadowDescriptor descriptor 
)
overridevirtual

Sets all of the shadow properties in one call.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetShadowTransform()

void AZ::Render::ProjectedShadowFeatureProcessor::SetShadowTransform ( ShadowId  id,
Transform  transform 
)
overridevirtual

Sets the world space transform of where the shadow is cast from.

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ SetUseCachedShadows()

void AZ::Render::ProjectedShadowFeatureProcessor::SetUseCachedShadows ( ShadowId  id,
bool  useCachedShadows 
)
overridevirtual

Sets if this shadow should be rendered every frame or only when it detects a change. Changes are detected by the presence of a flag on the view which tracks if any of the draws submitted to it contained that flag. The mesh feature processor sets this flag on any cullable that moves, and it is combined with all other flags for draws submitted to each view. See MeshCommon::MeshMovedName for the name of the flag used to track movement See RPI::Scene::GetViewTagBitRegistry() for where the flag bits are determined See RPI::View::GetOrFlags() for how the bits are retrieved

Implements AZ::Render::ProjectedShadowFeatureProcessorInterface.

◆ Simulate()

void AZ::Render::ProjectedShadowFeatureProcessor::Simulate ( const SimulatePacket )
overridevirtual

The feature processor should perform any internal simulation at this point - For instance, updating a particle system or animation. Not every feature processor will need to implement this.

  • This may not be called every frame.
  • This may be called in parallel with other feature processors.

Reimplemented from AZ::RPI::FeatureProcessor.


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