Open 3D Engine AtomTressFX 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::Render::Hair::HairRenderObject Class Referencefinal

#include <HairRenderObject.h>

Inherits Data::InstanceData.

Public Member Functions

 AZ_RTTI (HairRenderObject, "{58F48A58-C5B9-4CAE-9AFD-9B3AF3A01C73}")
 
void Release ()
 
bool Init (HairFeatureProcessor *featureProcessor, const char *assetName, AMD::TressFXAsset *asset, AMD::TressFXSimulationSettings *simSettings, AMD::TressFXRenderingSettings *renderSettings)
 
bool BuildDrawPacket (RPI::Shader *geometryShader, RHI::DrawPacketBuilder::DrawRequest &drawRequest)
 
const RHI::DrawPacket * GetGeometrylDrawPacket (RPI::Shader *geometryShader)
 
bool BuildDispatchItem (RPI::Shader *computeShader, DispatchLevel dispatchLevel)
 Creates and fill the dispatch item associated with the compute shader.
 
const RHI::DispatchItem * GetDispatchItem (RPI::Shader *computeShader)
 
void PrepareHairGenerationSrgDescriptors (uint32_t vertexCount, uint32_t numStrands)
 
bool CreateAndBindHairGenerationBuffers (uint32_t vertexCount, uint32_t strandsCount)
 
bool UploadGPUData (const char *name, AMD::TressFXAsset *asset)
 
Data::Instance< RPI::ShaderResourceGroup > GetHairGenerationSrg ()
 
bool BindPerObjectSrgForCompute ()
 
bool BindPerObjectSrgForRaster ()
 
int GetNumTotalHairVertices () const
 
int GetNumTotalHairStrands () const
 
int GetNumVerticesPerStrand () const
 
int GetCPULocalShapeIterations () const
 
int GetNumFollowHairsPerGuideHair () const
 
int GetNumGuideHairs () const
 
bool PopulateDrawStrandsBindSet (AMD::TressFXRenderingSettings *pRenderSettings)
 
bool LoadImageAsset (AMD::TressFXRenderingSettings *pRenderSettings)
 
bool UploadRenderingGPUResources (AMD::TressFXAsset &asset)
 
bool CreateRenderingGPUResources (Data::Instance< RPI::Shader > shader, AMD::TressFXAsset &asset, const char *assetName)
 
bool Update ()
 
void UpdateBoneMatrices (const AMD::float4x4 *pBoneMatricesInWS, int numBoneMatrices)
 This method needs to be called in order to fill the bone matrices before the skinning.
 
void UpdateBoneMatrices (const AZ::Matrix3x4 &entityWorldMatrix, const AZStd::vector< AZ::Matrix3x4 > &boneMatrices)
 
void InitBoneMatricesPlaceHolder (int numBoneMatrices)
 
void SetFrameDeltaTime (float deltaTime)
 
void UpdateRenderingParameters (const AMD::TressFXRenderingSettings *parameters, const int nodePoolSize, float distance, bool shadowUpdate)
 
AMD::TressFXRenderParamsGetHairRenderParams ()
 
void UpdateSimulationParameters (const AMD::TressFXSimulationSettings *settings, float timeStep)
 
void SetWind (const Vector3 &windDir, float windMag, int frame)
 
void SetRenderIndex (uint32_t renderIndex)
 
void ResetPositions ()
 
void IncreaseSimulationFrame ()
 
bool IsEnabled ()
 
void SetEnabled (bool enable)
 

Detailed Description


                                HairRenderObject

This class is equivalent to TressFXHairObject and HairStrands (the later is mainly a wrapper).

This is the class that holds all the raw data used by all the hair passes and shaders.

Member Function Documentation

◆ CreateRenderingGPUResources()

bool AZ::Render::Hair::HairRenderObject::CreateRenderingGPUResources ( Data::Instance< RPI::Shader >  shader,
AMD::TressFXAsset asset,
const char *  assetName 
)

Creation of the render Srg m_hairRenderSrg, followed by creation and binding of the GPU render resources: vertex thickness, vertex UV, hair albedo maps and two constant buffers.

◆ GetNumTotalHairVertices()

int AZ::Render::Hair::HairRenderObject::GetNumTotalHairVertices ( ) const
inline

Methods partially imported from TressFXHairObject

◆ PopulateDrawStrandsBindSet()

bool AZ::Render::Hair::HairRenderObject::PopulateDrawStrandsBindSet ( AMD::TressFXRenderingSettings pRenderSettings)

This method is mainly a wrapper around BindRenderSrgResources to keep the connection in code to the TressFX method. Bind Render Srg (m_hairRenderSrg) resources. No resources data update should be doe here Notice that this also loads the images and is slower if a new asset is required. If the image was not changed it should only bind without the retrieve operation.

◆ UpdateBoneMatrices()

void AZ::Render::Hair::HairRenderObject::UpdateBoneMatrices ( const AZ::Matrix3x4 &  entityWorldMatrix,
const AZStd::vector< AZ::Matrix3x4 > &  boneMatrices 
)

update of the skinning matrices per frame. The matrices are in model / local space which is why the entity world matrix is also passed.

◆ UpdateRenderingParameters()

void AZ::Render::Hair::HairRenderObject::UpdateRenderingParameters ( const AMD::TressFXRenderingSettings parameters,
const int  nodePoolSize,
float  distance,
bool  shadowUpdate 
)

Updating the bone matrices for the skinning in the simulation constant buffer. pBoneMatricesInWS constraints array of column major bone matrices in world space.

◆ UpdateSimulationParameters()

void AZ::Render::Hair::HairRenderObject::UpdateSimulationParameters ( const AMD::TressFXSimulationSettings settings,
float  timeStep 
)

Update of simulation constant buffer. Notice that the bone matrices are set elsewhere and should be updated before GPU submit.

◆ UploadGPUData()

bool AZ::Render::Hair::HairRenderObject::UploadGPUData ( const char *  name,
AMD::TressFXAsset asset 
)

Updates the buffers data for the hair generation. Does NOT update the bone matrices - they will be updated every frame.


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