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::MaterialTypeAsset Class Reference

#include <MaterialTypeAsset.h>

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

Classes

struct  MaterialPipelinePayload
 Provides data about how to render the material in a particular render pipeline. More...
 

Public Types

using MaterialPipelineMap = AZStd::unordered_map< Name, MaterialPipelinePayload >
 

Public Member Functions

 AZ_RTTI (MaterialTypeAsset, "{CD7803AB-9C4C-4A33-9A14-7412F1665464}", AZ::Data::AssetData)
 
 AZ_CLASS_ALLOCATOR (MaterialTypeAsset, SystemAllocator)
 
const ShaderCollectionGetGeneralShaderCollection () const
 Return the general purpose shader collection that applies to any render pipeline.
 
const MaterialFunctorList & GetMaterialFunctors () const
 
const 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 Name &supervariantName) const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetMaterialSrgLayout () const
 
const Data::Asset< ShaderAsset > & GetShaderAssetForMaterialSrg () const
 Returns a ShaderAsset from @m_shaderCollection that contains the MaterialSrg layout.
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetObjectSrgLayout (const SupervariantIndex &supervariantIndex) const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetObjectSrgLayout (const Name &supervariantName) const
 
const RHI::Ptr< RHI::ShaderResourceGroupLayout > & GetObjectSrgLayout () const
 
const Data::Asset< ShaderAsset > & GetShaderAssetForObjectSrg () const
 Returns a ShaderAsset from @m_shaderCollection that contains the ObjectSrg layout.
 
const MaterialPropertiesLayoutGetMaterialPropertiesLayout () const
 Returns a layout that includes a list of MaterialPropertyDescriptors for each material property.
 
const AZStd::vector< MaterialPropertyValue > & GetDefaultPropertyValues () const
 
MaterialUvNameMap GetUvNameMap () const
 Returns a map from the UV shader inputs to a custom name.
 
uint32_t GetVersion () const
 Returns the version of the MaterialTypeAsset.
 
const MaterialVersionUpdatesGetMaterialVersionUpdates () const
 
bool ApplyPropertyRenames (Name &propertyId) const
 
bool InitializeNonSerializedData ()
 

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 AZ::u32 SubId = 0
 
static constexpr uint32_t InvalidShaderIndex = static_cast<uint32_t>(-1)
 

Friends

class MaterialTypeAssetCreator
 
class MaterialTypeAssetHandler
 

Detailed Description

MaterialTypeAsset defines the property layout and general behavior for a type of material. It serves as the foundation for MaterialAssets, which can be used to render meshes at runtime.

Use a MaterialTypeAssetCreator to create a MaterialTypeAsset.

Member Function Documentation

◆ ApplyPropertyRenames()

bool AZ::RPI::MaterialTypeAsset::ApplyPropertyRenames ( Name &  propertyId) const

Possibly renames @propertyId based on the material version update steps.

Returns
true if the property was renamed

◆ GetDefaultPropertyValues()

const AZStd::vector< MaterialPropertyValue > & AZ::RPI::MaterialTypeAsset::GetDefaultPropertyValues ( ) 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.

◆ GetMaterialFunctors()

const MaterialFunctorList & AZ::RPI::MaterialTypeAsset::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::MaterialTypeAsset::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::MaterialTypeAsset::GetMaterialSrgLayout ( const 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::MaterialTypeAsset::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::MaterialTypeAsset::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::MaterialTypeAsset::GetObjectSrgLayout ( const 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::MaterialTypeAsset::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.

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