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

#include <MeshFeatureProcessorInterface.h>

Inherits AZ::RPI::FeatureProcessor.

Inherited by AZ::Render::MeshFeatureProcessor, and UnitTest::MockMeshFeatureProcessor.

Public Types

using MeshHandle = StableDynamicArrayHandle< ModelDataInstanceInterface >
 
using DispatchArgumentsSetupCB = AZStd::function< void(uint32_t, uint32_t, uint32_t, const RHI::DrawItem *, RHI::DispatchDirect &)>
 

Public Member Functions

 AZ_RTTI (AZ::Render::MeshFeatureProcessorInterface, "{975D7F0C-2E7E-4819-94D0-D3C4E2024721}", AZ::RPI::FeatureProcessor)
 
virtual TransformServiceFeatureProcessorInterface::ObjectId GetObjectId (const MeshHandle &meshHandle) const =0
 Returns the object id for a mesh handle.
 
virtual MeshHandle AcquireMesh (const MeshHandleDescriptor &descriptor)=0
 Acquire a mesh handle for a model configured using the descriptor.
 
virtual bool ReleaseMesh (MeshHandle &meshHandle)=0
 Releases the mesh handle.
 
virtual MeshHandle CloneMesh (const MeshHandle &meshHandle)=0
 Creates a new instance and handle of a mesh using an existing MeshId. Currently, this will reset the new mesh to default materials.
 
virtual Data::Instance< RPI::ModelGetModel (const MeshHandle &meshHandle) const =0
 Gets the underlying RPI::Model instance for a meshHandle. May be null if the model has not loaded.
 
virtual Data::Asset< RPI::ModelAssetGetModelAsset (const MeshHandle &meshHandle) const =0
 Gets the underlying RPI::ModelAsset for a meshHandle.
 
virtual const RPI::MeshDrawPacketLods & GetDrawPackets (const MeshHandle &meshHandle) const =0
 
virtual const AZStd::vector< Data::Instance< RPI::ShaderResourceGroup > > & GetObjectSrgs (const MeshHandle &meshHandle) const =0
 
virtual void QueueObjectSrgForCompile (const MeshHandle &meshHandle) const =0
 Queues the object srg for compile.
 
virtual void SetCustomMaterials (const MeshHandle &meshHandle, const Data::Instance< RPI::Material > &material)=0
 
virtual void SetCustomMaterials (const MeshHandle &meshHandle, const CustomMaterialMap &materials)=0
 Sets the CustomMaterialMap for a meshHandle.
 
virtual const CustomMaterialMap & GetCustomMaterials (const MeshHandle &meshHandle) const =0
 Gets the CustomMaterialMap for a meshHandle.
 
virtual void SetDrawItemEnabled (const MeshHandle &meshHandle, RHI::DrawListTag drawListTag, bool enabled)=0
 Enables/Disables the mesh's DrawItem for the given drawListTag.
 
virtual void SetTransform (const MeshHandle &meshHandle, const Transform &transform, const Vector3 &nonUniformScale=Vector3::CreateOne())=0
 Sets the transform for a given mesh handle.
 
virtual Transform GetTransform (const MeshHandle &meshHandle)=0
 Gets the transform for a given mesh handle.
 
virtual Vector3 GetNonUniformScale (const MeshHandle &meshHandle)=0
 Gets the non-uniform scale for a given mesh handle.
 
virtual void SetLocalAabb (const MeshHandle &meshHandle, const AZ::Aabb &localAabb)=0
 Sets the local space bbox for a given mesh handle. You don't need to call this for static models, only skinned/animated models.
 
virtual AZ::Aabb GetLocalAabb (const MeshHandle &meshHandle) const =0
 Gets the local space bbox for a given mesh handle. Unless SetLocalAabb has been called before, this will be the bbox of the model asset.
 
virtual void SetSortKey (const MeshHandle &meshHandle, RHI::DrawItemSortKey sortKey)=0
 Sets the sort key for a given mesh handle.
 
virtual RHI::DrawItemSortKey GetSortKey (const MeshHandle &meshHandle) const =0
 Gets the sort key for a given mesh handle.
 
virtual void SetLightingChannelMask (const MeshHandle &meshHandle, uint32_t lightingChannelMask)=0
 Sets the lighting channel mask for a given mesh handle.
 
virtual uint32_t GetLightingChannelMask (const MeshHandle &meshHandle) const =0
 Gets the lighting channel mask for a given mesh handle.
 
virtual void SetMeshLodConfiguration (const MeshHandle &meshHandle, const RPI::Cullable::LodConfiguration &meshLodConfig)=0
 Sets LOD mesh configurations to be used in the Mesh Feature Processor.
 
virtual RPI::Cullable::LodConfiguration GetMeshLodConfiguration (const MeshHandle &meshHandle) const =0
 Gets the LOD mesh configurations being used in the Mesh Feature Processor.
 
virtual void SetExcludeFromReflectionCubeMaps (const MeshHandle &meshHandle, bool excludeFromReflectionCubeMaps)=0
 Sets the option to exclude this mesh from baked reflection probe cubemaps.
 
virtual bool GetExcludeFromReflectionCubeMaps (const MeshHandle &meshHandle) const =0
 Gets the if this mesh is excluded from baked reflection probe cubemaps.
 
virtual void SetIsAlwaysDynamic (const MeshHandle &meshHandle, bool isAlwaysDynamic)=0
 Sets a mesh to be considered to be always moving even if the transform hasn't changed. This is useful for meshes that are skinned or have vertex animation.
 
virtual bool GetIsAlwaysDynamic (const MeshHandle &meshHandle) const =0
 Gets if a mesh is considered to always be moving.
 
virtual void SetRayTracingEnabled (const MeshHandle &meshHandle, bool enabled)=0
 Sets the option to exclude this mesh from raytracing.
 
virtual bool GetRayTracingEnabled (const MeshHandle &meshHandle) const =0
 Gets whether this mesh is excluded from raytracing.
 
virtual void SetVisible (const MeshHandle &meshHandle, bool visible)=0
 Sets the mesh as visible or hidden. When the mesh is hidden it will not be rendered by the feature processor.
 
virtual bool GetVisible (const MeshHandle &meshHandle) const =0
 
virtual void SetUseForwardPassIblSpecular (const MeshHandle &meshHandle, bool useForwardPassIblSpecular)=0
 Sets the mesh to render IBL specular in the forward pass.
 
virtual void SetRayTracingDirty (const MeshHandle &meshHandle)=0
 Set a flag that the ray tracing data needs to be updated, usually after material changes.
 
virtual void PrintDrawPacketInfo (const MeshHandle &meshHandle)=0
 Print out info about the mesh draw packet.
 
virtual AZStd::unique_ptr< StreamBufferViewsBuilderInterfaceCreateStreamBufferViewsBuilder (const MeshHandle &meshHandle) const =0
 
virtual DispatchDrawItemList BuildDispatchDrawItemList (const MeshHandle &meshHandle, const uint32_t lodIndex, const uint32_t meshIndex, const RHI::DrawListMask drawListTagsFilter, const RHI::DrawFilterMask materialPipelineFilter, DispatchArgumentsSetupCB dispatchArgumentsSetupCB) const =0
 
- 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 ()
 

Additional Inherited Members

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

Detailed Description

MeshFeatureProcessorInterface provides an interface to acquire and release a MeshHandle from the underlying MeshFeatureProcessor

Member Typedef Documentation

◆ DispatchArgumentsSetupCB

using AZ::Render::MeshFeatureProcessorInterface::DispatchArgumentsSetupCB = AZStd::function<void(uint32_t , uint32_t , uint32_t , const RHI::DrawItem*, RHI::DispatchDirect&)>

MaterialTypes and MaterialPipelines support Compute Shaders (With DrawListTag) in their ShaderItem collections. Given that this is an uncommon use case, the DispatchItems are not created automatically by the MeshDrawPacket. Additionally DispatchItems require knowledge of the Total number of threads X,Y,Z, which should be customizable. The following function helps the creation of the DispatchItems and the user must supply a callback that allows full control on the number of Total Threads X,Y,Z. REMARK 1: It is recommended to call this function whenever ModelDataInstanceInterface::MeshDrawPacketUpdatedEvent is signaled. REMARK 2: This function is typically called by a custom FeatureProcessor that leverages the MeshFeatureProcessor. The custom FeatureProcessor will own the returned list and submit the DispatchItems in a custom Pass.

Member Function Documentation

◆ AcquireMesh()

virtual MeshHandle AZ::Render::MeshFeatureProcessorInterface::AcquireMesh ( const MeshHandleDescriptor descriptor)
pure virtual

Acquire a mesh handle for a model configured using the descriptor.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ BuildDispatchDrawItemList()

virtual DispatchDrawItemList AZ::Render::MeshFeatureProcessorInterface::BuildDispatchDrawItemList ( const MeshHandle meshHandle,
const uint32_t  lodIndex,
const uint32_t  meshIndex,
const RHI::DrawListMask  drawListTagsFilter,
const RHI::DrawFilterMask  materialPipelineFilter,
DispatchArgumentsSetupCB  dispatchArgumentsSetupCB 
) const
pure virtual

DisptachItems will be created for the DrawItems that match both the @drawListTagsFilter and @materialPipelineFilter. Also, only DrawItems whose PipelineState is of Compute type will be considered.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ CloneMesh()

virtual MeshHandle AZ::Render::MeshFeatureProcessorInterface::CloneMesh ( const MeshHandle meshHandle)
pure virtual

Creates a new instance and handle of a mesh using an existing MeshId. Currently, this will reset the new mesh to default materials.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ CreateStreamBufferViewsBuilder()

virtual AZStd::unique_ptr< StreamBufferViewsBuilderInterface > AZ::Render::MeshFeatureProcessorInterface::CreateStreamBufferViewsBuilder ( const MeshHandle meshHandle) const
pure virtual

A helper function, typically called by another FeatureProcessor, when Compute or RayTracing shaders need to bind Mesh Input Streams like "POSITION", "NORMAL", "UV1" etc as regular AZ::RHI::BufferViews. This function instantiates a concrete Builder-like object that helps creating the RHI::BufferViews.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetCustomMaterials()

virtual const CustomMaterialMap & AZ::Render::MeshFeatureProcessorInterface::GetCustomMaterials ( const MeshHandle meshHandle) const
pure virtual

Gets the CustomMaterialMap for a meshHandle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetDrawPackets()

virtual const RPI::MeshDrawPacketLods & AZ::Render::MeshFeatureProcessorInterface::GetDrawPackets ( const MeshHandle meshHandle) const
pure virtual

This function provides insight into what materials, shaders, etc. are actively being used to render the model. Useful for custom feature processors that work in tandem with the MeshFeatureProcessor.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetExcludeFromReflectionCubeMaps()

virtual bool AZ::Render::MeshFeatureProcessorInterface::GetExcludeFromReflectionCubeMaps ( const MeshHandle meshHandle) const
pure virtual

Gets the if this mesh is excluded from baked reflection probe cubemaps.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetIsAlwaysDynamic()

virtual bool AZ::Render::MeshFeatureProcessorInterface::GetIsAlwaysDynamic ( const MeshHandle meshHandle) const
pure virtual

Gets if a mesh is considered to always be moving.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetLightingChannelMask()

virtual uint32_t AZ::Render::MeshFeatureProcessorInterface::GetLightingChannelMask ( const MeshHandle meshHandle) const
pure virtual

Gets the lighting channel mask for a given mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetLocalAabb()

virtual AZ::Aabb AZ::Render::MeshFeatureProcessorInterface::GetLocalAabb ( const MeshHandle meshHandle) const
pure virtual

Gets the local space bbox for a given mesh handle. Unless SetLocalAabb has been called before, this will be the bbox of the model asset.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetMeshLodConfiguration()

virtual RPI::Cullable::LodConfiguration AZ::Render::MeshFeatureProcessorInterface::GetMeshLodConfiguration ( const MeshHandle meshHandle) const
pure virtual

Gets the LOD mesh configurations being used in the Mesh Feature Processor.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetModel()

virtual Data::Instance< RPI::Model > AZ::Render::MeshFeatureProcessorInterface::GetModel ( const MeshHandle meshHandle) const
pure virtual

Gets the underlying RPI::Model instance for a meshHandle. May be null if the model has not loaded.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetModelAsset()

virtual Data::Asset< RPI::ModelAsset > AZ::Render::MeshFeatureProcessorInterface::GetModelAsset ( const MeshHandle meshHandle) const
pure virtual

Gets the underlying RPI::ModelAsset for a meshHandle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetNonUniformScale()

virtual Vector3 AZ::Render::MeshFeatureProcessorInterface::GetNonUniformScale ( const MeshHandle meshHandle)
pure virtual

Gets the non-uniform scale for a given mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetObjectId()

virtual TransformServiceFeatureProcessorInterface::ObjectId AZ::Render::MeshFeatureProcessorInterface::GetObjectId ( const MeshHandle meshHandle) const
pure virtual

Returns the object id for a mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetObjectSrgs()

virtual const AZStd::vector< Data::Instance< RPI::ShaderResourceGroup > > & AZ::Render::MeshFeatureProcessorInterface::GetObjectSrgs ( const MeshHandle meshHandle) const
pure virtual

Gets the ObjectSrgs for a meshHandle. Updating the ObjectSrgs should be followed by a call to QueueObjectSrgForCompile, instead of compiling the srgs directly. This way, if the srgs have already been queued for compile, they will not be queued twice in the same frame. The ObjectSrgs should not be updated during Simulate, or it will create a race between updating the data and the call to Compile Cases where there may be multiple ObjectSrgs: if a model has multiple submeshes and those submeshes use different materials with different object SRGs.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetRayTracingEnabled()

virtual bool AZ::Render::MeshFeatureProcessorInterface::GetRayTracingEnabled ( const MeshHandle meshHandle) const
pure virtual

Gets whether this mesh is excluded from raytracing.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetSortKey()

virtual RHI::DrawItemSortKey AZ::Render::MeshFeatureProcessorInterface::GetSortKey ( const MeshHandle meshHandle) const
pure virtual

Gets the sort key for a given mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetTransform()

virtual Transform AZ::Render::MeshFeatureProcessorInterface::GetTransform ( const MeshHandle meshHandle)
pure virtual

Gets the transform for a given mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ GetVisible()

virtual bool AZ::Render::MeshFeatureProcessorInterface::GetVisible ( const MeshHandle meshHandle) const
pure virtual

Returns the visibility state of the mesh. This only refers to whether or not the mesh has been explicitly hidden, and is not related to view frustum visibility.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ PrintDrawPacketInfo()

virtual void AZ::Render::MeshFeatureProcessorInterface::PrintDrawPacketInfo ( const MeshHandle meshHandle)
pure virtual

Print out info about the mesh draw packet.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ QueueObjectSrgForCompile()

virtual void AZ::Render::MeshFeatureProcessorInterface::QueueObjectSrgForCompile ( const MeshHandle meshHandle) const
pure virtual

Queues the object srg for compile.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ ReleaseMesh()

virtual bool AZ::Render::MeshFeatureProcessorInterface::ReleaseMesh ( MeshHandle meshHandle)
pure virtual

Releases the mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetCustomMaterials() [1/2]

virtual void AZ::Render::MeshFeatureProcessorInterface::SetCustomMaterials ( const MeshHandle meshHandle,
const CustomMaterialMap &  materials 
)
pure virtual

Sets the CustomMaterialMap for a meshHandle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetCustomMaterials() [2/2]

virtual void AZ::Render::MeshFeatureProcessorInterface::SetCustomMaterials ( const MeshHandle meshHandle,
const Data::Instance< RPI::Material > &  material 
)
pure virtual

Sets the CustomMaterialMap for a meshHandle, using just a single material for the DefaultCustomMaterialId. Note if there is already a CustomMaterialMap, this will replace the entire map with just a single material.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetDrawItemEnabled()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetDrawItemEnabled ( const MeshHandle meshHandle,
RHI::DrawListTag  drawListTag,
bool  enabled 
)
pure virtual

Enables/Disables the mesh's DrawItem for the given drawListTag.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetExcludeFromReflectionCubeMaps()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetExcludeFromReflectionCubeMaps ( const MeshHandle meshHandle,
bool  excludeFromReflectionCubeMaps 
)
pure virtual

Sets the option to exclude this mesh from baked reflection probe cubemaps.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetIsAlwaysDynamic()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetIsAlwaysDynamic ( const MeshHandle meshHandle,
bool  isAlwaysDynamic 
)
pure virtual

Sets a mesh to be considered to be always moving even if the transform hasn't changed. This is useful for meshes that are skinned or have vertex animation.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetLightingChannelMask()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetLightingChannelMask ( const MeshHandle meshHandle,
uint32_t  lightingChannelMask 
)
pure virtual

Sets the lighting channel mask for a given mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetLocalAabb()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetLocalAabb ( const MeshHandle meshHandle,
const AZ::Aabb &  localAabb 
)
pure virtual

Sets the local space bbox for a given mesh handle. You don't need to call this for static models, only skinned/animated models.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetMeshLodConfiguration()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetMeshLodConfiguration ( const MeshHandle meshHandle,
const RPI::Cullable::LodConfiguration meshLodConfig 
)
pure virtual

Sets LOD mesh configurations to be used in the Mesh Feature Processor.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetRayTracingDirty()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetRayTracingDirty ( const MeshHandle meshHandle)
pure virtual

Set a flag that the ray tracing data needs to be updated, usually after material changes.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetRayTracingEnabled()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetRayTracingEnabled ( const MeshHandle meshHandle,
bool  enabled 
)
pure virtual

Sets the option to exclude this mesh from raytracing.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetSortKey()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetSortKey ( const MeshHandle meshHandle,
RHI::DrawItemSortKey  sortKey 
)
pure virtual

Sets the sort key for a given mesh handle.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetUseForwardPassIblSpecular()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetUseForwardPassIblSpecular ( const MeshHandle meshHandle,
bool  useForwardPassIblSpecular 
)
pure virtual

Sets the mesh to render IBL specular in the forward pass.

Implemented in AZ::Render::MeshFeatureProcessor.

◆ SetVisible()

virtual void AZ::Render::MeshFeatureProcessorInterface::SetVisible ( const MeshHandle meshHandle,
bool  visible 
)
pure virtual

Sets the mesh as visible or hidden. When the mesh is hidden it will not be rendered by the feature processor.

Implemented in AZ::Render::MeshFeatureProcessor.


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