Documentation / scene / HairStrandData
Class: HairStrandData
Defined in: libs/scene/src/material/hairstrand_data.ts:73
GPU-resident strand geometry for HairStrandMaterial.
Remarks
Strands live in storage buffers rather than vertex buffers, because the ribbon geometry is generated in the vertex shader from the control points rather than stored. That is what makes a full-density hair set affordable: the CPU-side ribbon for a 69k-strand cap costs 266 MB of vertex data, while the control points it was built from are around 20 MB.
Two buffers:
- Headers, one per strand: first point index, point count, packed root UV, and a seed for per-strand variation.
- Points, one per control point: position and width.
Both are read-only to the render pass. A simulation pass may write the point buffer in place, which is why positions and widths are interleaved: a solver touches position and leaves width alone, and keeping them in one buffer avoids a second binding.
Extends
Disposable
Constructors
Constructor
new HairStrandData(
source):HairStrandData
Defined in: libs/scene/src/material/hairstrand_data.ts:89
Uploads strand geometry to the GPU.
Parameters
source
Strand control points and topology.
Returns
HairStrandData
Overrides
Disposable.constructor
Accessors
disposed
Get Signature
get disposed():
boolean
Defined in: libs/base/dist/index.d.ts:6107
Returns
boolean
Inherited from
Disposable.disposed
strandCount
Get Signature
get strandCount():
number
Defined in: libs/scene/src/material/hairstrand_data.ts:181
Number of strands.
Returns
number
pointCount
Get Signature
get pointCount():
number
Defined in: libs/scene/src/material/hairstrand_data.ts:185
Total control point count across all strands.
Returns
number
maxPointsPerStrand
Get Signature
get maxPointsPerStrand():
number
Defined in: libs/scene/src/material/hairstrand_data.ts:189
Largest control point count of any single strand.
Returns
number
headerBuffer
Get Signature
get headerBuffer():
GPUDataBuffer<unknown>
Defined in: libs/scene/src/material/hairstrand_data.ts:193
Per-strand header buffer.
Returns
GPUDataBuffer<unknown>
pointBuffer
Get Signature
get pointBuffer():
GPUDataBuffer<unknown>
Defined in: libs/scene/src/material/hairstrand_data.ts:197
Per-control-point buffer holding position and width.
Returns
GPUDataBuffer<unknown>
byteLength
Get Signature
get byteLength():
number
Defined in: libs/scene/src/material/hairstrand_data.ts:201
Bytes of GPU memory held by the two buffers.
Returns
number
Methods
on()
on<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:630
IEventTarget.on
Type Parameters
K
K extends "dispose"
Parameters
type
K
listener
EventListener<{ dispose: []; }, K>
context?
unknown
Returns
void
Inherited from
Disposable.on
once()
once<
K>(type,listener,context?):void
Defined in: libs/base/dist/index.d.ts:634
IEventTarget.once
Type Parameters
K
K extends "dispose"
Parameters
type
K
listener
EventListener<{ dispose: []; }, K>
context?
unknown
Returns
void
Inherited from
Disposable.once
off()
off<
K>(type,listener?,context?):void
Defined in: libs/base/dist/index.d.ts:638
IEventTarget.off
Type Parameters
K
K extends "dispose"
Parameters
type
K
listener?
EventListener<{ dispose: []; }>
context?
unknown
Returns
void
Inherited from
Disposable.off
dispatchEvent()
dispatchEvent<
K>(type, ...args):void
Defined in: libs/base/dist/index.d.ts:642
IEventTarget.dispatchEvent
Type Parameters
K
K extends "dispose"
Parameters
type
K
args
...object[K]
Returns
void
Inherited from
Disposable.dispatchEvent
dispose()
dispose():
void
Defined in: libs/base/dist/index.d.ts:6108
Returns
void
Inherited from
Disposable.dispose
onDispose()
protectedonDispose():void
Defined in: libs/scene/src/material/hairstrand_data.ts:204
Returns
void
Overrides
Disposable.onDispose