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::DirectionalLightFeatureProcessor Class Referencefinal

Inherits AZ::Render::DirectionalLightFeatureProcessorInterface.

Classes

struct  CascadeSegment
 
struct  ShadowProperty
 

Public Member Functions

 AZ_RTTI (AZ::Render::DirectionalLightFeatureProcessor, "61610178-8DAA-4BF2-AF17-597F20D527DD", AZ::Render::DirectionalLightFeatureProcessorInterface)
 
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
 
LightHandle AcquireLight () override
 
bool ReleaseLight (LightHandle &handle) override
 
LightHandle CloneLight (LightHandle handle) override
 
void SetRgbIntensity (LightHandle handle, const PhotometricColor< PhotometricUnit::Lux > &lightColor) override
 
void SetDirection (LightHandle handle, const Vector3 &lightDirection) override
 
void SetAngularDiameter (LightHandle handle, float angularDiameter) override
 
void SetShadowmapSize (LightHandle handle, ShadowmapSize size) override
 
void SetCascadeCount (LightHandle handle, uint16_t cascadeCount) override
 
void SetShadowmapFrustumSplitSchemeRatio (LightHandle handle, float ratio) override
 
void SetCascadeFarDepth (LightHandle handle, uint16_t cascadeIndex, float farDepth) override
 
void SetCameraConfiguration (LightHandle handle, const Camera::Configuration &cameraConfiguration, const RPI::RenderPipelineId &renderPipelineId=RPI::RenderPipelineId()) override
 
void SetShadowFarClipDistance (LightHandle handle, float farDist) override
 
void SetCameraTransform (LightHandle handle, const Transform &cameraTransform, const RPI::RenderPipelineId &renderPipelineId=RPI::RenderPipelineId()) override
 
void SetGroundHeight (LightHandle handle, float groundHeight) override
 
void SetViewFrustumCorrectionEnabled (LightHandle handle, bool enabled) override
 
void SetDebugFlags (LightHandle handle, DebugDrawFlags flags) override
 
void SetShadowFilterMethod (LightHandle handle, ShadowFilterMethod method) override
 
void SetFilteringSampleCount (LightHandle handle, uint16_t count) override
 
void SetShadowReceiverPlaneBiasEnabled (LightHandle handle, bool enable) override
 
void SetCascadeBlendingEnabled (LightHandle handle, bool enable) override
 Sets whether or not blending between shadow map cascades is enabled.
 
void SetShadowBias (LightHandle handle, float bias) override
 Reduces acne by applying a small amount of bias along shadow-space z.
 
void SetNormalShadowBias (LightHandle handle, float normalShadowBias) override
 Reduces acne by biasing the shadowmap lookup along the geometric normal.
 
void SetFullscreenBlurEnabled (LightHandle handle, bool enable) override
 Sets whether or not to apply fullscreen blur after fullscreen shadow pass.
 
void SetFullscreenBlurConstFalloff (LightHandle handle, float blurConstFalloff) override
 Sets the amount of constant falloff on the fullscreen shadow blur.
 
void SetFullscreenBlurDepthFalloffStrength (LightHandle handle, float blurDepthFalloffStrength) override
 Sets the strength of the depth falloff on the fullscreen shadow blur.
 
void SetAffectsGI (LightHandle handle, bool affectsGI) override
 Specifies if this light affects the diffuse global illumination in the scene.
 
void SetAffectsGIFactor (LightHandle handle, float affectsGIFactor) override
 Specifies the contribution of this light to the diffuse global illumination in the scene.
 
const Data::Instance< RPI::BufferGetLightBuffer () const
 
uint32_t GetLightCount () const
 
ShadowPropertyGetShadowProperty (LightHandle handle)
 
- Public Member Functions inherited from AZ::Render::DirectionalLightFeatureProcessorInterface
 AZ_RTTI (AZ::Render::DirectionalLightFeatureProcessorInterface, "82C274F8-C635-4725-9ECB-0D7FA0DC0C6C", AZ::RPI::FeatureProcessor)
 
virtual LightHandle AcquireLight ()=0
 
virtual bool ReleaseLight (LightHandle &lightHandle)=0
 
virtual LightHandle CloneLight (LightHandle lightHandle)=0
 
virtual void SetRgbIntensity (LightHandle handle, const PhotometricColor< PhotometricUnit::Lux > &lightColor)=0
 
virtual void SetDirection (LightHandle handle, const Vector3 &direction)=0
 
virtual void SetAngularDiameter (LightHandle handle, float angularDiameter)=0
 
virtual void SetShadowmapSize (LightHandle handle, ShadowmapSize size)=0
 
virtual void SetCascadeCount (LightHandle handle, uint16_t cascadeCount)=0
 
virtual void SetShadowmapFrustumSplitSchemeRatio (LightHandle handle, float ratio)=0
 
virtual void SetCascadeFarDepth (LightHandle handle, uint16_t cascadeIndex, float farDepth)=0
 
virtual void SetCameraConfiguration (LightHandle handle, const Camera::Configuration &cameraConfiguration, const RPI::RenderPipelineId &renderPipelineId=RPI::RenderPipelineId())=0
 
virtual void SetShadowFarClipDistance (LightHandle handle, float farDist)=0
 
virtual void SetCameraTransform (LightHandle handle, const Transform &cameraTransform, const RPI::RenderPipelineId &renderPipelineId=RPI::RenderPipelineId())=0
 
virtual void SetGroundHeight (LightHandle handle, float groundHeight)=0
 
virtual void SetViewFrustumCorrectionEnabled (LightHandle, bool enabled)=0
 
virtual void SetDebugFlags (LightHandle handle, DebugDrawFlags flags)=0
 
virtual void SetShadowFilterMethod (LightHandle handle, ShadowFilterMethod method)=0
 
virtual void SetFilteringSampleCount (LightHandle handle, uint16_t count)=0
 
virtual void SetShadowReceiverPlaneBiasEnabled (LightHandle handle, bool enable)=0
 
virtual void SetShadowBias (LightHandle handle, float bias)=0
 Reduces acne by applying a small amount of bias along shadow-space z.
 
virtual void SetNormalShadowBias (LightHandle handle, float normalShadowBias)=0
 Reduces acne by biasing the shadowmap lookup along the geometric normal.
 
virtual void SetCascadeBlendingEnabled (LightHandle handle, bool enable)=0
 Sets whether or not blending between shadow map cascades is enabled.
 
virtual void SetFullscreenBlurEnabled (LightHandle handle, bool enable)=0
 Sets whether or not to apply fullscreen blur after fullscreen shadow pass.
 
virtual void SetFullscreenBlurConstFalloff (LightHandle handle, float blurConstFalloff)=0
 Sets the amount of constant falloff on the fullscreen shadow blur.
 
virtual void SetFullscreenBlurDepthFalloffStrength (LightHandle handle, float blurDepthFalloffStrength)=0
 Sets the strength of the depth falloff on the fullscreen shadow blur.
 
virtual void SetAffectsGI (LightHandle handle, bool affectsGI)=0
 Specifies if this light affects the diffuse global illumination in the scene.
 
virtual void SetAffectsGIFactor (LightHandle handle, float affectsGIFactor)=0
 Specifies the contribution of this light to the diffuse global illumination in the scene.
 
- 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::DirectionalLightFeatureProcessorInterface
enum  DebugDrawFlags : uint32_t { DebugDrawNone = 0b000 , DebugDrawColoring = 0b001 , DebugDrawBoundingBoxes = 0b010 , DebugDrawAll = ~DebugDrawNone }
 
using LightHandle = RHI::Handle< uint16_t, class DirectionalLight >
 
- Protected Member Functions inherited from AZ::RPI::FeatureProcessor
void EnableSceneNotification ()
 
void DisableSceneNotification ()
 

Member Function Documentation

◆ AcquireLight()

LightHandle AZ::Render::DirectionalLightFeatureProcessor::AcquireLight ( )
overridevirtual

This creates a new directional light which can be referenced by the returned LightHandle. This must be released via ReleaseLight() when no longer needed.

Returns
the handle of the new directional light.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ Activate()

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

Perform any necessary activation and gives access to owning Scene.

Reimplemented from AZ::RPI::FeatureProcessor.

◆ CloneLight()

LightHandle AZ::Render::DirectionalLightFeatureProcessor::CloneLight ( LightHandle  lightHandle)
overridevirtual

This creates a new LightHandle by copying data from an existing LightHandle.

Parameters
lightHandlethe handle to clone.
Returns
the handle of the new cloned light.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ Deactivate()

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

Perform any necessary deactivation.

Reimplemented from AZ::RPI::FeatureProcessor.

◆ ReleaseLight()

bool AZ::Render::DirectionalLightFeatureProcessor::ReleaseLight ( LightHandle lightHandle)
overridevirtual

This releases a LightHandle which removes the directional light.

Parameters
lightHandlethe handle to release.
Returns
true if it is released.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ Render()

void AZ::Render::DirectionalLightFeatureProcessor::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.

◆ SetAffectsGI()

void AZ::Render::DirectionalLightFeatureProcessor::SetAffectsGI ( LightHandle  handle,
bool  affectsGI 
)
overridevirtual

Specifies if this light affects the diffuse global illumination in the scene.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetAffectsGIFactor()

void AZ::Render::DirectionalLightFeatureProcessor::SetAffectsGIFactor ( LightHandle  handle,
float  affectsGIFactor 
)
overridevirtual

Specifies the contribution of this light to the diffuse global illumination in the scene.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetAngularDiameter()

void AZ::Render::DirectionalLightFeatureProcessor::SetAngularDiameter ( LightHandle  handle,
float  angularDiameter 
)
overridevirtual

This sets a directional light's angular diameter. This value should be small, for instance the sun is 0.5 degrees across.

Parameters
handlethe light handle.
angularDiameterDirectional light's angular diameter in degrees.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetCameraConfiguration()

void AZ::Render::DirectionalLightFeatureProcessor::SetCameraConfiguration ( LightHandle  handle,
const Camera::Configuration &  cameraConfiguration,
const RPI::RenderPipelineId &  renderPipelineId = RPI::RenderPipelineId() 
)
overridevirtual

This sets camera configuration which affect to cascade segmentation.

Parameters
handlethe light handle.
cameraConfigurationthe camera configuration.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetCameraTransform()

void AZ::Render::DirectionalLightFeatureProcessor::SetCameraTransform ( LightHandle  handle,
const Transform &  cameraTransform,
const RPI::RenderPipelineId &  renderPipelineId = RPI::RenderPipelineId() 
)
overridevirtual

This sets camera transform which affect to cascade segmentation.

Parameters
handlethe light handle.
Returns
cameraTransform the camera transform.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetCascadeBlendingEnabled()

void AZ::Render::DirectionalLightFeatureProcessor::SetCascadeBlendingEnabled ( LightHandle  handle,
bool  enable 
)
overridevirtual

Sets whether or not blending between shadow map cascades is enabled.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetCascadeCount()

void AZ::Render::DirectionalLightFeatureProcessor::SetCascadeCount ( LightHandle  handle,
uint16_t  cascadeCount 
)
overridevirtual

This sets cascade count of the shadowmap.

Parameters
handlethe light handle.
cascadeCountthe count of cascade (from 1 to 4).

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetCascadeFarDepth()

void AZ::Render::DirectionalLightFeatureProcessor::SetCascadeFarDepth ( LightHandle  handle,
uint16_t  cascadeIndex,
float  farDepth 
)
overridevirtual

This sets the far depth of the cascade. If this is called, the ratio of frustum split scheme will be ignored.

Parameters
handlethe light handle.
cascadeIndexthe index of the cascade to be changed.
farDepththe far depth to be set.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetDebugFlags()

void AZ::Render::DirectionalLightFeatureProcessor::SetDebugFlags ( LightHandle  handle,
DebugDrawFlags  flags 
)
overridevirtual

This specifies what debug features to display.

Parameters
handlethe light handle.
flagsflags specifying the debug features. See DebugDrawFlags for more info. By drawing debug colors and bounding boxes, we can see how cascading of shadowmaps works.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetDirection()

void AZ::Render::DirectionalLightFeatureProcessor::SetDirection ( LightHandle  handle,
const Vector3 &  direction 
)
overridevirtual

This sets the direction of the light. direction should be normalized.

Parameters
handlethe light handle.
Returns
direction the direction of the light.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetFilteringSampleCount()

void AZ::Render::DirectionalLightFeatureProcessor::SetFilteringSampleCount ( LightHandle  handle,
uint16_t  count 
)
overridevirtual

This sets sample count for filtering of shadow boundary.

Parameters
handlethe light handle.
countSample Count for filtering (up to 64)

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetFullscreenBlurConstFalloff()

void AZ::Render::DirectionalLightFeatureProcessor::SetFullscreenBlurConstFalloff ( LightHandle  handle,
float  blurConstFalloff 
)
overridevirtual

Sets the amount of constant falloff on the fullscreen shadow blur.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetFullscreenBlurDepthFalloffStrength()

void AZ::Render::DirectionalLightFeatureProcessor::SetFullscreenBlurDepthFalloffStrength ( LightHandle  handle,
float  blurDepthFalloffStrength 
)
overridevirtual

Sets the strength of the depth falloff on the fullscreen shadow blur.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetFullscreenBlurEnabled()

void AZ::Render::DirectionalLightFeatureProcessor::SetFullscreenBlurEnabled ( LightHandle  handle,
bool  enable 
)
overridevirtual

Sets whether or not to apply fullscreen blur after fullscreen shadow pass.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetGroundHeight()

void AZ::Render::DirectionalLightFeatureProcessor::SetGroundHeight ( LightHandle  handle,
float  groundHeight 
)
overridevirtual

This specifies the height of the ground.

Parameters
handlethe light handle.
groundHeightheight of the ground. The position of view frustum is corrected using groundHeight to get better quality of shadow around the area close to the camera. To enable the correction, SetViewFrustumCorrectionEnabled(true) is required.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetNormalShadowBias()

void AZ::Render::DirectionalLightFeatureProcessor::SetNormalShadowBias ( LightHandle  handle,
float  normalShadowBias 
)
overridevirtual

Reduces acne by biasing the shadowmap lookup along the geometric normal.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetRgbIntensity()

void AZ::Render::DirectionalLightFeatureProcessor::SetRgbIntensity ( LightHandle  handle,
const PhotometricColor< PhotometricUnit::Lux > &  lightColor 
)
overridevirtual

This sets the intensity in RGB lux for a given LightHandle.

Parameters
handlethe light handle.
lightColorthe intensity in RGB lux.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetShadowBias()

void AZ::Render::DirectionalLightFeatureProcessor::SetShadowBias ( LightHandle  handle,
float  bias 
)
overridevirtual

Reduces acne by applying a small amount of bias along shadow-space z.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetShadowFarClipDistance()

void AZ::Render::DirectionalLightFeatureProcessor::SetShadowFarClipDistance ( LightHandle  handle,
float  farDist 
)
overridevirtual

This sets shadow specific far clip depth. Pixels beyond the far clip depth do not receive shadows. Reducing this value improves shadow quality.

Parameters
handlethe light handle.
farDistthe far clip depth.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetShadowFilterMethod()

void AZ::Render::DirectionalLightFeatureProcessor::SetShadowFilterMethod ( LightHandle  handle,
ShadowFilterMethod  method 
)
overridevirtual

This specifies filter method of shadows.

Parameters
handlethe light handle.
methodfilter method.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetShadowmapFrustumSplitSchemeRatio()

void AZ::Render::DirectionalLightFeatureProcessor::SetShadowmapFrustumSplitSchemeRatio ( LightHandle  handle,
float  ratio 
)
overridevirtual

This sets ratio between logarithm/uniform scheme to split view frustum. If this is called, frustum splitting becomes automatic and the far depths given by SetCascadeFarDepth() are discarded.

Parameters
handlethe light handle.
ratiothe ratio (in [0,1]) between logarithm scheme and uniform scheme to split view frustum into segments. ratio==0 means uniform and ratio==1 means logarithm. uniform: the most detailed cascade covers wider area but less detailed. logarithm: the most detailed cascade covers narrower area but more detailed. The least detailed cascade is not affected by this parameter.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetShadowmapSize()

void AZ::Render::DirectionalLightFeatureProcessor::SetShadowmapSize ( LightHandle  handle,
ShadowmapSize  size 
)
overridevirtual

This sets the shadowmap size (width and height) of the light.

Parameters
handlethe light handle.
sizethe shadowmap size (width/height).

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetShadowReceiverPlaneBiasEnabled()

void AZ::Render::DirectionalLightFeatureProcessor::SetShadowReceiverPlaneBiasEnabled ( LightHandle  handle,
bool  enable 
)
overridevirtual

Sets whether the directional shadowmap should use receiver plane bias. This attempts to reduce shadow acne when using large pcf filters.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ SetViewFrustumCorrectionEnabled()

void AZ::Render::DirectionalLightFeatureProcessor::SetViewFrustumCorrectionEnabled ( LightHandle  ,
bool  enabled 
)
overridevirtual

This specifies whether view frustum correction is enabled or not.

Parameters
handlethe light handle.
enabledflag specifying whether view frustum positions are corrected. The calculation of it is caused when position or configuration of the camera is changed.

Implements AZ::Render::DirectionalLightFeatureProcessorInterface.

◆ Simulate()

void AZ::Render::DirectionalLightFeatureProcessor::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: