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::RPI::MaterialAsset Class Reference

#include <MaterialAsset.h>

Inherits AZ::Data::AssetData, and AssetInitBus::Handler.

Public Member Functions

 AZ_RTTI (MaterialAsset, "{522C7BE0-501D-463E-92C6-15184A2B7AD8}", AZ::Data::AssetData)
 
 AZ_CLASS_ALLOCATOR (MaterialAsset, SystemAllocator)
 
bool InitializeNonSerializedData ()
 
const Data::Asset< MaterialTypeAsset > & GetMaterialTypeAsset () const
 Returns the MaterialTypeAsset.
 
const ShaderCollectionGetGeneralShaderCollection () const
 Return the general purpose shader collection that applies to any render pipeline.
 
const MaterialFunctorList & GetMaterialFunctors () const
 
const MaterialTypeAsset::MaterialPipelineMap & GetMaterialPipelinePayloads () const
 Return the collection of MaterialPipelinePayload data for all supported material pipelines.
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetMaterialSrgLayout (const SupervariantIndex &supervariantIndex) const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetMaterialSrgLayout (const AZ::Name &supervariantName) const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetMaterialSrgLayout () const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetObjectSrgLayout (const SupervariantIndex &supervariantIndex) const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetObjectSrgLayout (const AZ::Name &supervariantName) const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetObjectSrgLayout () const
 
const MaterialPropertiesLayoutGetMaterialPropertiesLayout () const
 Returns a layout that includes a list of MaterialPropertyDescriptors for each material property.
 
const AZStd::vector< MaterialPropertyValue > & GetPropertyValues () const
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 

Static Public Attributes

static const char * DisplayName
 
static const char * Group
 
static const char * Extension
 
static constexpr uint32_t UnspecifiedMaterialTypeVersion = static_cast<uint32_t>(-1)
 

Friends

class MaterialVersionUpdates
 
class MaterialAssetCreator
 
class MaterialAssetHandler
 

Detailed Description

MaterialAsset defines a single material, which can be used to create a Material instance for rendering at runtime. Use a MaterialAssetCreator to create a MaterialAsset.

Member Function Documentation

◆ GetMaterialFunctors()

const MaterialFunctorList & AZ::RPI::MaterialAsset::GetMaterialFunctors ( ) const

The material may contain any number of MaterialFunctors. Material functors provide custom logic and calculations to configure shaders, render states, and more. See MaterialFunctor.h for details.

◆ GetMaterialSrgLayout() [1/3]

const RHI::Ptr< RHI::ShaderResourceGroupLayout > & AZ::RPI::MaterialAsset::GetMaterialSrgLayout ( ) const

Just like the original GetMaterialSrgLayout() where it uses the index of the default supervariant. See the definition of DefaultSupervariantIndex.

◆ GetMaterialSrgLayout() [2/3]

const RHI::Ptr< RHI::ShaderResourceGroupLayout > & AZ::RPI::MaterialAsset::GetMaterialSrgLayout ( const AZ::Name &  supervariantName) const

Same as above but accepts the supervariant name. There's a minor penalty when using this function because it will discover the index from the name.

◆ GetMaterialSrgLayout() [3/3]

const RHI::Ptr< RHI::ShaderResourceGroupLayout > & AZ::RPI::MaterialAsset::GetMaterialSrgLayout ( const SupervariantIndex supervariantIndex) const

Returns the shader resource group layout that has per-material frequency, which indicates most of the topology for a material's shaders. All shaders in a material will have the same per-material SRG layout.

Parameters
supervariantIndexsupervariant index to get the layout from.

◆ GetObjectSrgLayout() [1/3]

const RHI::Ptr< RHI::ShaderResourceGroupLayout > & AZ::RPI::MaterialAsset::GetObjectSrgLayout ( ) const

Just like the original GetObjectSrgLayout() where it uses the index of the default supervariant. See the definition of DefaultSupervariantIndex.

◆ GetObjectSrgLayout() [2/3]

const RHI::Ptr< RHI::ShaderResourceGroupLayout > & AZ::RPI::MaterialAsset::GetObjectSrgLayout ( const AZ::Name &  supervariantName) const

Same as above but accepts the supervariant name. There's a minor penalty when using this function because it will discover the index from the name.

◆ GetObjectSrgLayout() [3/3]

const RHI::Ptr< RHI::ShaderResourceGroupLayout > & AZ::RPI::MaterialAsset::GetObjectSrgLayout ( const SupervariantIndex supervariantIndex) const

Returns the shader resource group layout that has per-object frequency. What constitutes an "object" is an agreement between the FeatureProcessor and the shaders, but an example might be world-transform for a model. All shaders in a material will have the same per-object SRG layout.

Parameters
supervariantIndexsupervariant index to get the layout from.

◆ GetPropertyValues()

const AZStd::vector< MaterialPropertyValue > & AZ::RPI::MaterialAsset::GetPropertyValues ( ) const

Returns the list of values for all properties in this material. The entries in this list align with the entries in the MaterialPropertiesLayout. Each AZStd::any is guaranteed to have a value of type that matches the corresponding MaterialPropertyDescriptor. For images, the value will be of type ImageBinding.

Note that even though material source data files contain only override values and inherit the rest from their parent material, they all get flattened at build time so every MaterialAsset has the full set of values.

Calling GetPropertyValues() will automatically finalize the material asset if it isn't finalized already. The MaterialTypeAsset must be loaded and ready.


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