This feature processor manages ray tracing data for a Scene. More...
#include <RayTracingFeatureProcessor.h>
Inherits AZ::Render::RayTracingFeatureProcessorInterface.
Public Member Functions | |
AZ_RTTI (AZ::Render::RayTracingFeatureProcessor, "{5017EFD3-A996-44B0-9ED2-C47609A2EE8D}", AZ::Render::RayTracingFeatureProcessorInterface) | |
void | Activate () override |
Perform any necessary activation and gives access to owning Scene. | |
void | Deactivate () override |
Perform any necessary deactivation. | |
void | OnRenderPipelineChanged (RPI::RenderPipeline *renderPipeline, RPI::SceneNotification::RenderPipelineChangeType changeType) override |
ProceduralGeometryTypeHandle | RegisterProceduralGeometryType (const AZStd::string &name, const Data::Instance< RPI::Shader > &intersectionShader, const AZStd::string &intersectionShaderName, const AZStd::unordered_map< int, uint32_t > &bindlessBufferIndices={}) override |
void | SetProceduralGeometryTypeBindlessBufferIndex (ProceduralGeometryTypeWeakHandle geometryTypeHandle, const AZStd::unordered_map< int, uint32_t > &bindlessBufferIndices) override |
void | AddProceduralGeometry (ProceduralGeometryTypeWeakHandle geometryTypeHandle, const Uuid &uuid, const Aabb &aabb, const SubMeshMaterial &material, RHI::RayTracingAccelerationStructureInstanceInclusionMask instanceMask, uint32_t localInstanceIndex) override |
void | SetProceduralGeometryTransform (const Uuid &uuid, const Transform &transform, const Vector3 &nonUniformScale=Vector3::CreateOne()) override |
void | SetProceduralGeometryLocalInstanceIndex (const Uuid &uuid, uint32_t localInstanceIndex) override |
void | SetProceduralGeometryMaterial (const Uuid &uuid, const SubMeshMaterial &material) override |
void | RemoveProceduralGeometry (const Uuid &uuid) override |
int | GetProceduralGeometryCount (ProceduralGeometryTypeWeakHandle geometryTypeHandle) const override |
const ProceduralGeometryTypeList & | GetProceduralGeometryTypes () const override |
Retrieves the list of all procedural geometry types in the scene. | |
const ProceduralGeometryList & | GetProceduralGeometries () const override |
Retrieves the list of all procedural geometry instances in the scene. | |
void | AddMesh (const AZ::Uuid &uuid, const Mesh &rayTracingMesh, const SubMeshVector &subMeshes) override |
void | RemoveMesh (const AZ::Uuid &uuid) override |
void | SetMeshTransform (const AZ::Uuid &uuid, const AZ::Transform transform, const AZ::Vector3 nonUniformScale) override |
void | SetMeshReflectionProbe (const AZ::Uuid &uuid, const Mesh::ReflectionProbe &reflectionProbe) override |
void | SetMeshMaterials (const AZ::Uuid &uuid, const SubMeshMaterialVector &subMeshMaterials) override |
Sets the material for a mesh. | |
const SubMeshVector & | GetSubMeshes () const override |
Retrieves the map of all subMeshes in the scene. | |
SubMeshVector & | GetSubMeshes () override |
const MeshMap & | GetMeshMap () override |
uint32_t | GetSubMeshCount () const override |
Retrieves the total number of ray tracing meshes. | |
uint32_t | GetSkinnedMeshCount () const override |
REturns the number of skinned meshes. | |
Data::Instance< RPI::ShaderResourceGroup > | GetRayTracingSceneSrg () const override |
Retrieves the RayTracingSceneSrg. | |
Data::Instance< RPI::ShaderResourceGroup > | GetRayTracingMaterialSrg () const override |
Retrieves the RayTracingMaterialSrg. | |
const Data::Instance< RPI::Buffer > | GetMeshInfoGpuBuffer () const override |
Retrieves the GPU buffer containing information for all ray tracing meshes. | |
const Data::Instance< RPI::Buffer > | GetMaterialInfoGpuBuffer () const override |
Retrieves the GPU buffer containing information for all ray tracing materials. | |
void | Render (const RenderPacket &) override |
void | BeginFrame () override |
uint32_t | GetRevision () const override |
uint32_t | GetProceduralGeometryTypeRevision () const override |
RHI::RayTracingBufferPools & | GetBufferPools () override |
Retrieves the buffer pools used for ray tracing operations. | |
void | UpdateRayTracingSrgs () override |
const RHI::Ptr< RHI::RayTracingTlas > & | GetTlas () const override |
Retrieves the RayTracingTlas. | |
RHI::Ptr< RHI::RayTracingTlas > & | GetTlas () override |
RHI::AttachmentId | GetTlasAttachmentId () const override |
Retrieves the attachmentId of the Tlas for this scene. | |
BlasInstanceMap & | GetBlasInstances () override |
AZStd::mutex & | GetBlasBuiltMutex () override |
Provide access to the mutex protecting the blasBuilt flag. | |
BlasBuildList & | GetBlasBuildList (int deviceIndex) override |
const BlasBuildList & | GetSkinnedMeshBlasList () override |
BlasBuildList & | GetBlasCompactionList (int deviceIndex) override |
const void | MarkBlasInstanceForCompaction (int deviceIndex, Data::AssetId assetId) override |
const void | MarkBlasInstanceAsCompactionEnqueued (int deviceIndex, Data::AssetId assetId) override |
bool | HasMeshGeometry () const override |
Returns true if the ray tracing scene contains mesh geometry. | |
bool | HasProceduralGeometry () const override |
Returns true if the ray tracing scene contains procedural geometry. | |
bool | HasGeometry () const override |
Returns true if the ray tracing scene contains mesh or procedural geometry. | |
![]() | |
AZ_RTTI (AZ::Render::RayTracingFeatureProcessorInterface, "{84C37D5E-3676-4E39-A0E6-CB048E2F7E5E}", AZ::RPI::FeatureProcessor) | |
virtual void | SetMeshReflectionProbe (const AZ::Uuid &uuid, const Mesh::ReflectionProbe &reflectionProbe)=0 |
Sets the reflection probe for a mesh. | |
![]() | |
AZ_RTTI (FeatureProcessor, "{B8027170-C65C-4237-964D-B557FC9D7575}") | |
AZ_CLASS_ALLOCATOR (FeatureProcessor, AZ::SystemAllocator) | |
Scene * | GetParentScene () const |
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 | OnEndCulling (const RenderPacket &) |
virtual void | OnRenderEnd () |
Static Public Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
Additional Inherited Members | |
![]() | |
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 > |
![]() | |
void | EnableSceneNotification () |
void | DisableSceneNotification () |
This feature processor manages ray tracing data for a Scene.
|
overridevirtual |
Perform any necessary activation and gives access to owning Scene.
Reimplemented from AZ::RPI::FeatureProcessor.
|
overridevirtual |
Adds ray tracing data for a mesh. This will cause an update to the RayTracing acceleration structure on the next frame
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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. |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
If necessary recreates TLAS buffers and updates the ray tracing SRGs. Should only be called by the RayTracingAccelerationStructurePass.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
Perform any necessary deactivation.
Reimplemented from AZ::RPI::FeatureProcessor.
|
inlineoverridevirtual |
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
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Provide access to the mutex protecting the blasBuilt flag.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
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
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the buffer pools used for ray tracing operations.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the GPU buffer containing information for all ray tracing materials.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the GPU buffer containing information for all ray tracing meshes.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the list of all procedural geometry instances in the scene.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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 . |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
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.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the list of all procedural geometry types in the scene.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the RayTracingMaterialSrg.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the RayTracingSceneSrg.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the revision number of the ray tracing data. This is used to determine if the RayTracingShaderTable needs to be rebuilt.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
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
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
REturns the number of skinned meshes.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the total number of ray tracing meshes.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the map of all subMeshes in the scene.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the RayTracingTlas.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Retrieves the attachmentId of the Tlas for this scene.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Returns true if the ray tracing scene contains mesh or procedural geometry.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Returns true if the ray tracing scene contains mesh geometry.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
inlineoverridevirtual |
Returns true if the ray tracing scene contains procedural geometry.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
Signals that the Blas compaction has been enqueued The original uncompacted BLAS will be deleted when it's no longer needed
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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. Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
Removes ray tracing data for a mesh. This will cause an update to the RayTracing acceleration structure on the next frame
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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. |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
The feature processor should enqueue draw packets to relevant draw lists.
Reimplemented from AZ::RPI::FeatureProcessor.
|
overridevirtual |
Sets the material for a mesh.
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
Sets the ray tracing mesh transform This will cause an update to the RayTracing acceleration structure on the next frame
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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. |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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. |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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. |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
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() . |
Implements AZ::Render::RayTracingFeatureProcessorInterface.
|
overridevirtual |
Updates the RayTracingSceneSrg and RayTracingMaterialSrg, called after the TLAS is allocated in the RayTracingAccelerationStructurePass
Implements AZ::Render::RayTracingFeatureProcessorInterface.