This feature processor manages ray tracing data for a Scene. More...
#include <RayTracingFeatureProcessorInterface.h>
Inherits AZ::RPI::FeatureProcessor.
Inherited by AZ::Render::RayTracingFeatureProcessor.
Classes | |
struct | Mesh |
Contains data for the top level mesh, including the list of sub-meshes. More... | |
struct | MeshBlasInstance |
struct | ProceduralGeometry |
Contains data for procedural geometry instances. More... | |
struct | ProceduralGeometryType |
Contains data for procedural geometry which uses an intersection shader for hit detection. More... | |
struct | SubMesh |
Contains data for a single subMesh. More... | |
struct | SubMeshBlasInstance |
struct | SubMeshMaterial |
Contains material data for a single subMesh. More... | |
Public Types | |
using | SubMeshVector = AZStd::vector< SubMesh > |
using | SubMeshMaterialVector = AZStd::vector< SubMeshMaterial > |
using | IndexVector = AZStd::vector< uint32_t > |
using | ProceduralGeometryTypeHandle = StableDynamicArrayHandle< ProceduralGeometryType > |
using | ProceduralGeometryTypeWeakHandle = StableDynamicArrayWeakHandle< ProceduralGeometryType > |
using | ProceduralGeometryTypeList = StableDynamicArray< ProceduralGeometryType > |
using | ProceduralGeometryList = AZStd::vector< ProceduralGeometry > |
using | MeshMap = AZStd::map< AZ::Uuid, Mesh > |
using | BlasInstanceMap = AZStd::unordered_map< AZ::Data::AssetId, MeshBlasInstance > |
using | BlasBuildList = AZStd::unordered_set< AZ::Data::AssetId > |
Public Member Functions | |
AZ_RTTI (AZ::Render::RayTracingFeatureProcessorInterface, "{84C37D5E-3676-4E39-A0E6-CB048E2F7E5E}", AZ::RPI::FeatureProcessor) | |
virtual ProceduralGeometryTypeHandle | RegisterProceduralGeometryType (const AZStd::string &name, const Data::Instance< RPI::Shader > &intersectionShader, const AZStd::string &intersectionShaderName, const AZStd::unordered_map< int, uint32_t > &bindlessBufferIndices={})=0 |
virtual void | SetProceduralGeometryTypeBindlessBufferIndex (ProceduralGeometryTypeWeakHandle geometryTypeHandle, const AZStd::unordered_map< int, uint32_t > &bindlessBufferIndices)=0 |
virtual void | AddProceduralGeometry (ProceduralGeometryTypeWeakHandle geometryTypeHandle, const Uuid &uuid, const Aabb &aabb, const SubMeshMaterial &material, RHI::RayTracingAccelerationStructureInstanceInclusionMask instanceMask, uint32_t localInstanceIndex)=0 |
virtual void | SetProceduralGeometryTransform (const Uuid &uuid, const Transform &transform, const Vector3 &nonUniformScale=Vector3::CreateOne())=0 |
virtual void | SetProceduralGeometryLocalInstanceIndex (const Uuid &uuid, uint32_t localInstanceIndex)=0 |
virtual void | SetProceduralGeometryMaterial (const Uuid &uuid, const SubMeshMaterial &material)=0 |
virtual void | RemoveProceduralGeometry (const Uuid &uuid)=0 |
virtual int | GetProceduralGeometryCount (ProceduralGeometryTypeWeakHandle geometryTypeHandle) const =0 |
virtual void | AddMesh (const AZ::Uuid &uuid, const Mesh &rayTracingMesh, const SubMeshVector &subMeshes)=0 |
virtual void | RemoveMesh (const AZ::Uuid &uuid)=0 |
virtual void | SetMeshTransform (const AZ::Uuid &uuid, const AZ::Transform transform, const AZ::Vector3 nonUniformScale)=0 |
virtual void | SetMeshReflectionProbe (const AZ::Uuid &uuid, const Mesh::ReflectionProbe &reflectionProbe)=0 |
Sets the reflection probe for a mesh. | |
virtual void | SetMeshMaterials (const AZ::Uuid &uuid, const SubMeshMaterialVector &subMeshMaterials)=0 |
Sets the material for a mesh. | |
virtual const SubMeshVector & | GetSubMeshes () const =0 |
Retrieves the map of all subMeshes in the scene. | |
virtual SubMeshVector & | GetSubMeshes ()=0 |
virtual const MeshMap & | GetMeshMap ()=0 |
virtual Data::Instance< RPI::ShaderResourceGroup > | GetRayTracingSceneSrg () const =0 |
Retrieves the RayTracingSceneSrg. | |
virtual Data::Instance< RPI::ShaderResourceGroup > | GetRayTracingMaterialSrg () const =0 |
Retrieves the RayTracingMaterialSrg. | |
virtual const RHI::Ptr< RHI::RayTracingTlas > & | GetTlas () const =0 |
Retrieves the RayTracingTlas. | |
virtual RHI::Ptr< RHI::RayTracingTlas > & | GetTlas ()=0 |
virtual uint32_t | GetRevision () const =0 |
virtual uint32_t | GetProceduralGeometryTypeRevision () const =0 |
virtual AZStd::mutex & | GetBlasBuiltMutex ()=0 |
Provide access to the mutex protecting the blasBuilt flag. | |
virtual uint32_t | GetSkinnedMeshCount () const =0 |
REturns the number of skinned meshes. | |
virtual RHI::RayTracingBufferPools & | GetBufferPools ()=0 |
Retrieves the buffer pools used for ray tracing operations. | |
virtual uint32_t | GetSubMeshCount () const =0 |
Retrieves the total number of ray tracing meshes. | |
virtual bool | HasMeshGeometry () const =0 |
Returns true if the ray tracing scene contains mesh geometry. | |
virtual bool | HasProceduralGeometry () const =0 |
Returns true if the ray tracing scene contains procedural geometry. | |
virtual bool | HasGeometry () const =0 |
Returns true if the ray tracing scene contains mesh or procedural geometry. | |
virtual RHI::AttachmentId | GetTlasAttachmentId () const =0 |
Retrieves the attachmentId of the Tlas for this scene. | |
virtual const Data::Instance< RPI::Buffer > | GetMeshInfoGpuBuffer () const =0 |
Retrieves the GPU buffer containing information for all ray tracing meshes. | |
virtual const Data::Instance< RPI::Buffer > | GetMaterialInfoGpuBuffer () const =0 |
Retrieves the GPU buffer containing information for all ray tracing materials. | |
virtual void | BeginFrame ()=0 |
virtual void | UpdateRayTracingSrgs ()=0 |
virtual BlasInstanceMap & | GetBlasInstances ()=0 |
virtual BlasBuildList & | GetBlasBuildList (int deviceIndex)=0 |
virtual const BlasBuildList & | GetSkinnedMeshBlasList ()=0 |
virtual BlasBuildList & | GetBlasCompactionList (int deviceIndex)=0 |
virtual const void | MarkBlasInstanceForCompaction (int deviceIndex, Data::AssetId assetId)=0 |
virtual const void | MarkBlasInstanceAsCompactionEnqueued (int deviceIndex, Data::AssetId assetId)=0 |
virtual const ProceduralGeometryTypeList & | GetProceduralGeometryTypes () const =0 |
Retrieves the list of all procedural geometry types in the scene. | |
virtual const ProceduralGeometryList & | GetProceduralGeometries () const =0 |
Retrieves the list of all procedural geometry instances in the scene. | |
![]() | |
AZ_RTTI (FeatureProcessor, "{B8027170-C65C-4237-964D-B557FC9D7575}") | |
AZ_CLASS_ALLOCATOR (FeatureProcessor, AZ::SystemAllocator) | |
Scene * | GetParentScene () 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 | |
![]() | |
void | EnableSceneNotification () |
void | DisableSceneNotification () |
This feature processor manages ray tracing data for a Scene.
using AZ::Render::RayTracingFeatureProcessorInterface::MeshMap = AZStd::map<AZ::Uuid, Mesh> |
Mesh data for meshes that should be included in ray tracing operations, this is a map of the mesh UUID to the ray tracing data for the sub-meshes
|
pure virtual |
Adds ray tracing data for a mesh. This will cause an update to the RayTracing acceleration structure on the next frame
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Adds a procedural geometry to the ray tracing scene.
geometryTypeHandle | A weak handle of a procedural geometry type (obtained by calling .GetWeakHandle() on the handle returned by RegisterProceduralGeometryType . |
uuid | The Uuid this geometry instance should be associated with. |
aabb | The axis-aligned bounding box of this geometry instance. |
material | The material of this geometry instance. |
instanceMask | Used to include/exclude mesh instances from TraceRay() calls. |
localInstanceIndex | An index which can be queried in the intersection shader with GetLocalInstanceIndex() and can be used together with GetBindlessBufferIndex() to access per-instance geometry data. |
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
If necessary recreates TLAS buffers and updates the ray tracing SRGs. Should only be called by the RayTracingAccelerationStructurePass.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Returns the list of Blas instance asset ids that need to be built for the given device The returned asset ids can be used to access the Blas instance returned by GetBlasInstances The caller is responsible for deleting entries that where enqueued for building
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Provide access to the mutex protecting the blasBuilt flag.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Returns the list of Blas instance asset ids that are ready for compaction The returned asset ids can be used to access the Blas instance returned by GetBlasInstances The caller is responsible for deleting entries that where enqueued for building
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the buffer pools used for ray tracing operations.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the GPU buffer containing information for all ray tracing materials.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the GPU buffer containing information for all ray tracing meshes.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the list of all procedural geometry instances in the scene.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Returns the number of procedural geometry instances of a given procedural geometry type.
geometryTypeHandle | A weak handle of a procedural geometry type(obtained by calling .GetWeakHandle() on the handle returned by RegisterProceduralGeometryType . |
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the revision number of the procedural geometry data of the ray tracing data. This is used to determine if the RayTracingPipelineState needs to be recreated.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the list of all procedural geometry types in the scene.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the RayTracingMaterialSrg.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the RayTracingSceneSrg.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the revision number of the ray tracing data. This is used to determine if the RayTracingShaderTable needs to be rebuilt.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Returns the asset id of all skinned mesh Blas instances in the scene The returned asset ids can be used to access the Blas instance returned by GetBlasInstances
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
REturns the number of skinned meshes.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the total number of ray tracing meshes.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the map of all subMeshes in the scene.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the RayTracingTlas.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Retrieves the attachmentId of the Tlas for this scene.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Returns true if the ray tracing scene contains mesh or procedural geometry.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Returns true if the ray tracing scene contains mesh geometry.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Returns true if the ray tracing scene contains procedural geometry.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Signals that the Blas compaction has been enqueued The original uncompacted BLAS will be deleted when it's no longer needed
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Signals that the compaction size queries of the asset have been enqueued The mesh will be inserted into the queue returned by GetBlasCompactionList when the compacted size is ready
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Registers a new procedural geometry type, which uses an intersection shader to determine hits for ray tracing.
name | The name this procedural geometry type should be associated with. It must be unique within the ray tracing pipeline as it is used to match hit group records to hit groups. |
intersectionShader | The intersection that should be used for procedural geometry of this type. The intersection shader must include the file <Atom/Features/RayTracing/RayTracingSrgs.azsli> and must use the struct ProceduralGeometryIntersectionAttributes to forward its hit parameters to ReportHit(). |
intersectionShaderName | The name of the intersection shader entry function within m_intersectionShader. |
bindlessBufferIndex | A single 32-bit value which can be queried in the intersection shader with GetBindlessBufferIndex() . This value is in most cases obtained by calling GetBindlessReadIndex() on a RHI BufferView, such that it can be accessed with Bindless::GetByteAddressBuffer(GetBindlessBufferIndex()) in the intersection shader. |
.Free()
), this procedural geometry type is also destroyed. This handle should be regarded as an opaque pointer, meaning that no member variables should be accessed or changed directly. Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Removes ray tracing data for a mesh. This will cause an update to the RayTracing acceleration structure on the next frame
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Removes a procedural geometry instance from the ray tracing scene.
uuid | The Uuid of the procedrual geometry which must have been added with AddProceduralGeometry before. |
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Sets the material for a mesh.
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Sets the ray tracing mesh transform This will cause an update to the RayTracing acceleration structure on the next frame
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Sets the local index by which this instance can be addressed in the intersection shader.
uuid | The Uuid of the procedural geometry which must have been added with AddProceduralGeometry before. |
localInstanceIndex | An index which can be queried in the intersection shader with GetLocalInstanceIndex() and can be used together with GetBindlessBufferIndex() to access per-instance geometry data. |
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Sets the material of a procedural geometry instance.
uuid | The Uuid of the procedural geometry which must have been added with AddProceduralGeometry before. |
material | The material of the procedural geometry instance. |
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Sets the transform of a procedural geometry instance.
uuid | The Uuid of the procedural geometry which must have been added with AddProceduralGeometry before. |
transform | The transform of the procedural geometry instance. |
nonUniformScale | The non-uniform scale of the procedural geometry instance. |
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Sets the bindlessBufferIndices of a procedural geometry type. This is necessary if the buffer, whose bindless read index was passed to RegisterProceduralGeometryType
, is resized or recreated.
geometryTypeHandle | A weak handle of a procedural geometry type (obtained by calling .GetWeakHandle() on the handle returned by RegisterProceduralGeometryType . |
bindlessBufferIndices | A single 32-bit value which can be queried in the intersection shader with GetBindlessBufferIndex() . |
Implemented in AZ::Render::RayTracingFeatureProcessor.
|
pure virtual |
Updates the RayTracingSceneSrg and RayTracingMaterialSrg, called after the TLAS is allocated in the RayTracingAccelerationStructurePass
Implemented in AZ::Render::RayTracingFeatureProcessor.