C# 클래스 TressFXLib.Hair

This is the main class for handling tressfx hair info.
파일 보기 프로젝트 열기: kennux/TressFXUnity 1 사용 예제들

공개 메소드들

메소드 설명
CreateBoundingSphere ( ) : void

Implicitly initializes the bounding sphere. Calculates the bounding sphere automatically

CreateIndices ( ) : void

Implicitly initializes the indices of this hair. This calculates the indices automatically

CreateUVs ( ) : void

UV-Maps the hair. The uv-coordinates will look like this: { STRAND_INDEX / STRAND_COUNT, VERTEX_INDEX / VERTEX_COUNT_IN_STRAND, 0, 0 }

Export ( HairFormat format, string path ) : void

Exports this hair to the given file format output.

Export ( IHairFormat format, string path ) : void

Exports this hair to the given file format class instance.

GenerateFollowHairs ( int followHairsPerGuidanceHair, float maxRadiusAroundGuideHair ) : void

Performs follow hair generation. If a hair file gets imported from a "not-tressfx" format like ase every hair will be set to be a guidance hair. With this functions its possible to generate hairs which will not get simulated, but moved along their guidance hair. This can get used to make hair more dense without simulation overhead.

Import ( HairFormat format, string path, TressFXLib.HairImportSettings importSettings = null ) : Hair

Loads / imports hair from the given file with given format.

InitializeBoundingSphere ( System.Vector3 center, float radius ) : void

Explicitly initializes the bounding sphere. Only used if the bounding sphere is loaded on import, for example in tfxb.

InitializeIndices ( int lineIndices, int triangleIndices ) : void

Explicitly initialized the indices of this hair. This function is only used if the indices are imported with the hair data, for example in tfxb. Only initialize them manually if you know what you are doing. They will get generated automatically in the getter functions.

InitializeSimulationData ( TressFXLib.HairSimulationData hairSimulationData ) : void

Explicitly initializes the simulation data. This is used in for example the tressfx binary importer.

NormalizeStrands ( int normalizedVertexCount ) : void

This function is used to make sure that every hair strand has the same vertex position. It uses linear interpolation in order to do so. After calling this, the simulation data must get reprepared, because the hair vertices will get reset.

PrepareSimulationParamatersAssetConverter ( int followHairs, float maxRadiusAround, string assetConverterExePath ) : Hair

TEMPORARY FUNCTION! THIS WILL GET REMOVED IN THE NEAR FUTURE! Prepares the simulation parameters by using a binary executable of the assetconverter from amd. Will return a new hair instance!

PrepareSimulationParameters ( ) : void

This function will get used by importers for example if there were only strand vertex positions available. It will calculate everything inside of the HairStrand and HairStrandVertex based off the vertex positions. It also calculates the bounding sphere parameters.

SetHairMesh ( int index, HairMesh mesh ) : void

Sets the given hairmesh into the given index. NOTE: TressFX only supports indices 0-3 (so max. 4 meshes).

SimulationPrecheck ( ) : bool

Returns true if the hair strands are all having a vertex count of 16. Developer Note: This will may get extended later on in order to do more advanced checks if simulation will run correctly.

비공개 메소드들

메소드 설명
BranchingAvoidance ( uint threadGroupSize = 64 ) : void

This is called in PrepareSimulationParameters(). It may deletes some hairs in order to avoid branching in the compute shader.

CreateHairSimulationData ( ) : TressFXLib.HairSimulationData

Creates a new HairSimulationData object and fills it with data from this hair's hair meshes. It can get used to "easy-export" tressfx-ready data-arrays from hair objects.

메소드 상세

CreateBoundingSphere() 공개 메소드

Implicitly initializes the bounding sphere. Calculates the bounding sphere automatically
public CreateBoundingSphere ( ) : void
리턴 void

CreateIndices() 공개 메소드

Implicitly initializes the indices of this hair. This calculates the indices automatically
public CreateIndices ( ) : void
리턴 void

CreateUVs() 공개 메소드

UV-Maps the hair. The uv-coordinates will look like this: { STRAND_INDEX / STRAND_COUNT, VERTEX_INDEX / VERTEX_COUNT_IN_STRAND, 0, 0 }
public CreateUVs ( ) : void
리턴 void

Export() 공개 메소드

Exports this hair to the given file format output.
public Export ( HairFormat format, string path ) : void
format HairFormat
path string
리턴 void

Export() 공개 메소드

Exports this hair to the given file format class instance.
public Export ( IHairFormat format, string path ) : void
format IHairFormat
path string
리턴 void

GenerateFollowHairs() 공개 메소드

Performs follow hair generation. If a hair file gets imported from a "not-tressfx" format like ase every hair will be set to be a guidance hair. With this functions its possible to generate hairs which will not get simulated, but moved along their guidance hair. This can get used to make hair more dense without simulation overhead.
public GenerateFollowHairs ( int followHairsPerGuidanceHair, float maxRadiusAroundGuideHair ) : void
followHairsPerGuidanceHair int
maxRadiusAroundGuideHair float
리턴 void

Import() 공개 정적인 메소드

Loads / imports hair from the given file with given format.
public static Import ( HairFormat format, string path, TressFXLib.HairImportSettings importSettings = null ) : Hair
format HairFormat
path string
importSettings TressFXLib.HairImportSettings
리턴 Hair

InitializeBoundingSphere() 공개 메소드

Explicitly initializes the bounding sphere. Only used if the bounding sphere is loaded on import, for example in tfxb.
public InitializeBoundingSphere ( System.Vector3 center, float radius ) : void
center System.Vector3
radius float
리턴 void

InitializeIndices() 공개 메소드

Explicitly initialized the indices of this hair. This function is only used if the indices are imported with the hair data, for example in tfxb. Only initialize them manually if you know what you are doing. They will get generated automatically in the getter functions.
public InitializeIndices ( int lineIndices, int triangleIndices ) : void
lineIndices int
triangleIndices int
리턴 void

InitializeSimulationData() 공개 메소드

Explicitly initializes the simulation data. This is used in for example the tressfx binary importer.
public InitializeSimulationData ( TressFXLib.HairSimulationData hairSimulationData ) : void
hairSimulationData TressFXLib.HairSimulationData
리턴 void

NormalizeStrands() 공개 메소드

This function is used to make sure that every hair strand has the same vertex position. It uses linear interpolation in order to do so. After calling this, the simulation data must get reprepared, because the hair vertices will get reset.
public NormalizeStrands ( int normalizedVertexCount ) : void
normalizedVertexCount int
리턴 void

PrepareSimulationParamatersAssetConverter() 공개 메소드

TEMPORARY FUNCTION! THIS WILL GET REMOVED IN THE NEAR FUTURE! Prepares the simulation parameters by using a binary executable of the assetconverter from amd. Will return a new hair instance!
public PrepareSimulationParamatersAssetConverter ( int followHairs, float maxRadiusAround, string assetConverterExePath ) : Hair
followHairs int
maxRadiusAround float
assetConverterExePath string
리턴 Hair

PrepareSimulationParameters() 공개 메소드

This function will get used by importers for example if there were only strand vertex positions available. It will calculate everything inside of the HairStrand and HairStrandVertex based off the vertex positions. It also calculates the bounding sphere parameters.
public PrepareSimulationParameters ( ) : void
리턴 void

SetHairMesh() 공개 메소드

Sets the given hairmesh into the given index. NOTE: TressFX only supports indices 0-3 (so max. 4 meshes).
public SetHairMesh ( int index, HairMesh mesh ) : void
index int
mesh HairMesh
리턴 void

SimulationPrecheck() 공개 메소드

Returns true if the hair strands are all having a vertex count of 16. Developer Note: This will may get extended later on in order to do more advanced checks if simulation will run correctly.
public SimulationPrecheck ( ) : bool
리턴 bool