Skip to content

Documentation / scene / HairStrandSource

Type Alias: HairStrandSource

HairStrandSource = object

Defined in: libs/scene/src/material/hairstrand_data.ts:18

Source strands, as produced by a curve importer.

Remarks

Control points are stored contiguously: strand i owns the pointCounts[i] points starting at the running sum of the preceding counts, which is the same layout Alembic uses.

Properties

positions

positions: Float32Array

Defined in: libs/scene/src/material/hairstrand_data.ts:20

Control point positions, 3 floats per point.


pointCounts

pointCounts: Int32Array | Uint32Array

Defined in: libs/scene/src/material/hairstrand_data.ts:22

Control point count per strand.


widths?

optional widths?: Nullable<Float32Array>

Defined in: libs/scene/src/material/hairstrand_data.ts:24

Per-point width, or null to fall back to defaultWidth.


widthPerStrand?

optional widthPerStrand?: boolean

Defined in: libs/scene/src/material/hairstrand_data.ts:26

True when widths holds one value per strand rather than per point.


uv?

optional uv?: Nullable<Float32Array>

Defined in: libs/scene/src/material/hairstrand_data.ts:28

Per-strand or per-point root UV, 2 floats each, or null.


defaultWidth?

optional defaultWidth?: number

Defined in: libs/scene/src/material/hairstrand_data.ts:30

Width used where the source provides none. Defaults to 0.0001.


scale?

optional scale?: number

Defined in: libs/scene/src/material/hairstrand_data.ts:41

Uniform scale applied to control points, positions and widths alike.

Remarks

Width is stored in the same linear unit as position, so both convert together. The sample XGen archive is authored in centimetres and carries widths of 0.0008 to 0.0159, which is 8 to 159 microns once scaled - the range real hair occupies. Leaving width unscaled makes strands a hundred times too thick, which reads as broad ribbons rather than hair.


widthScale?

optional widthScale?: number

Defined in: libs/scene/src/material/hairstrand_data.ts:49

Extra multiplier applied to width only.

Remarks

Separate from scale so thickness can be exaggerated for art direction without disturbing the unit conversion. Defaults to 1.

Released under the MIT License.