FHairAsset
A groom: guide curves in the asset's own space, read from a .mhair MDF file
- Module
- Game
- Header
#include "Hair/HairStrands.h"- Namespace
Mowo
Hair "Ponytail" { schema_version: 1 strands_per_guide: 24 // interpolated render strands per guide root_width: 0.004 // ribbon width at the root, world units tip_width: 0.001 clump_radius: 0.012 // spread of a guide's children at the root clumping: 0.35 // how far children pull back to their guide toward the tip Guide { points: [vec3(0, 1.7, 0), vec3(0, 1.65, -0.02), ...] }
Every guide is resampled to kPointsPerStrand points evenly along its length on load, so the simulation and the GPU ribbon expansion work on one fixed layout. BuildChildren then scatters the render strands: each child sits at a jittered root around its guide and follows the inverse-distance blend of the three nearest guides' shapes, pulled toward its own guide by Clumping.
Properties
| Type | Name | Description |
|---|---|---|
static constexpr uint32_t | kSchemaVersion | Default 1. |
static constexpr uint32_t | kPointsPerStrand | Default 16. |
std::string | Name | |
uint32_t | StrandsPerGuide | Default 16. |
float | RootWidth | Default 0.003f. |
float | TipWidth | Default 0.001f. |
float | ClumpRadius | Default 0.01f. |
float | Clumping | Default 0.3f. |
std::vector<FGuide> | Guides | |
std::vector<FChild> | Children |
Public functions
| Returns | Name | Description |
|---|---|---|
Ref<FHairAsset> | LoadFromString | |
Ref<FHairAsset> | Load | |
std::string | SaveToString | |
bool | SaveToFile | |
bool | AddGuide | Adds a guide from any polyline of at least two points (resampled). |
std::vector<Vec3> | Resample | Evenly spaced by arc length, root and tip kept exactly. |
void | BuildChildren | |
uint32_t | GetStrandCount |
Function details
LoadFromString
static Ref<FHairAsset> LoadFromString(const std::string& mdfText, std::string* error)Load
static Ref<FHairAsset> Load(const std::string& vfsPath, std::string* error)SaveToString
std::string SaveToString() constSaveToFile
bool SaveToFile(const std::string& nativePath) constAddGuide
bool AddGuide(const std::vector<Vec3>& curve)Adds a guide from any polyline of at least two points (resampled).
Resample
static std::vector<Vec3> Resample(const std::vector<Vec3>& curve, uint32_t count)Evenly spaced by arc length, root and tip kept exactly.
BuildChildren
void BuildChildren(uint32_t strandsPerGuide, uint32_t seed = 0x5EEDu)GetStrandCount
uint32_t GetStrandCount() const