Open 3D Engine Atom Gem API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Types | Public Member Functions | List of all members
AZ::Render::DirectionalLightFeatureProcessorInterface Class Referenceabstract

#include <DirectionalLightFeatureProcessorInterface.h>

Inherits AZ::RPI::FeatureProcessor.

Public Types

enum  DebugDrawFlags : uint32_t { DebugDrawNone = 0b000, DebugDrawColoring = 0b001, DebugDrawBoundingBoxes = 0b010, DebugDrawAll = ~DebugDrawNone }
 
using LightHandle = RHI::Handle< uint16_t, class DirectionalLight >
 

Public Member Functions

 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.
 
- Public Member Functions inherited from AZ::RPI::FeatureProcessor
 AZ_RTTI (FeatureProcessor, "{B8027170-C65C-4237-964D-B557FC9D7575}")
 
 AZ_CLASS_ALLOCATOR (FeatureProcessor, AZ::SystemAllocator, 0)
 
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 *)
 Apply changes and add additional render passes to the render pipeline from the feature processors.
 
virtual void PrepareViews (const PrepareViewsPacket &, AZStd::vector< AZStd::pair< PipelineViewTag, ViewPtr >> &)
 
virtual void Simulate (const SimulatePacket &)
 
virtual void Render (const RenderPacket &)
 
virtual void OnRenderEnd ()
 

Additional Inherited Members

- Protected Member Functions inherited from AZ::RPI::FeatureProcessor
void EnableSceneNotification ()
 
void DisableSceneNotification ()
 

Detailed Description

DirectionalLightFeatureProcessorInterface provides an interface to acquire, release, and update a directional light. This is necessary for code outside of the Atom features gem to communicate with the DirectionalLightFeatureProcessor.

Member Function Documentation

◆ AcquireLight()

virtual LightHandle AZ::Render::DirectionalLightFeatureProcessorInterface::AcquireLight ( )
pure virtual

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.

◆ CloneLight()

virtual LightHandle AZ::Render::DirectionalLightFeatureProcessorInterface::CloneLight ( LightHandle  lightHandle)
pure virtual

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.

◆ ReleaseLight()

virtual bool AZ::Render::DirectionalLightFeatureProcessorInterface::ReleaseLight ( LightHandle lightHandle)
pure virtual

This releases a LightHandle which removes the directional light.

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

◆ SetAngularDiameter()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetAngularDiameter ( LightHandle  handle,
float  angularDiameter 
)
pure virtual

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.

◆ SetCameraConfiguration()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetCameraConfiguration ( LightHandle  handle,
const Camera::Configuration &  cameraConfiguration,
const RPI::RenderPipelineId &  renderPipelineId = RPI::RenderPipelineId() 
)
pure virtual

This sets camera configuration which affect to cascade segmentation.

Parameters
handlethe light handle.
cameraConfigurationthe camera configuration.

◆ SetCameraTransform()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetCameraTransform ( LightHandle  handle,
const Transform &  cameraTransform,
const RPI::RenderPipelineId &  renderPipelineId = RPI::RenderPipelineId() 
)
pure virtual

This sets camera transform which affect to cascade segmentation.

Parameters
handlethe light handle.
Returns
cameraTransform the camera transform.

◆ SetCascadeCount()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetCascadeCount ( LightHandle  handle,
uint16_t  cascadeCount 
)
pure virtual

This sets cascade count of the shadowmap.

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

◆ SetCascadeFarDepth()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetCascadeFarDepth ( LightHandle  handle,
uint16_t  cascadeIndex,
float  farDepth 
)
pure virtual

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.

◆ SetDebugFlags()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetDebugFlags ( LightHandle  handle,
DebugDrawFlags  flags 
)
pure virtual

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.

◆ SetDirection()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetDirection ( LightHandle  handle,
const Vector3 &  direction 
)
pure virtual

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

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

◆ SetFilteringSampleCount()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetFilteringSampleCount ( LightHandle  handle,
uint16_t  count 
)
pure virtual

This sets sample count for filtering of shadow boundary.

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

◆ SetGroundHeight()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetGroundHeight ( LightHandle  handle,
float  groundHeight 
)
pure virtual

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.

◆ SetRgbIntensity()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetRgbIntensity ( LightHandle  handle,
const PhotometricColor< PhotometricUnit::Lux > &  lightColor 
)
pure virtual

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

Parameters
handlethe light handle.
lightColorthe intensity in RGB lux.

◆ SetShadowFarClipDistance()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetShadowFarClipDistance ( LightHandle  handle,
float  farDist 
)
pure virtual

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.

◆ SetShadowFilterMethod()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetShadowFilterMethod ( LightHandle  handle,
ShadowFilterMethod  method 
)
pure virtual

This specifies filter method of shadows.

Parameters
handlethe light handle.
methodfilter method.

◆ SetShadowmapFrustumSplitSchemeRatio()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetShadowmapFrustumSplitSchemeRatio ( LightHandle  handle,
float  ratio 
)
pure virtual

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.

◆ SetShadowmapSize()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetShadowmapSize ( LightHandle  handle,
ShadowmapSize  size 
)
pure virtual

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

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

◆ SetShadowReceiverPlaneBiasEnabled()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetShadowReceiverPlaneBiasEnabled ( LightHandle  handle,
bool  enable 
)
pure virtual

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

◆ SetViewFrustumCorrectionEnabled()

virtual void AZ::Render::DirectionalLightFeatureProcessorInterface::SetViewFrustumCorrectionEnabled ( LightHandle  ,
bool  enabled 
)
pure virtual

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.

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