drapedFolds
The height of a draped cloth at a point: rounded ridges running along one direction, each rippling and swaying along its length, gathered where the cloth is pinned.
drapedFolds(
coords: {along: Expr | number; across: Expr | number},
folds: Fold[],
opts: DrapeOptions,
): Expr
Import noise from shaders/std and use noise.drapedFolds.
coords come from a directionFrame: along runs 0 at the pinned edge to 1 at the free edge, across is the distance across the drape in the units foldSet laid the folds out in. ripple.waves is a wavyLine wave list each spine wanders by (every fold starts at its own phase) and ripple.gain scales it. sway moves all the folds together on the clock, like a breeze. swell makes each ridge rise and fall along its length so neighbours merge and part. pinning (0–1) gathers the folds at the pinned edge: narrow and still there, wide and free at the far edge. sharpness (default 2) is how tightly the ridge falls away and crease (0–1, default 0) flattens its crest into a plateau that meets the next fold in a tight valley: 0 is a round bell, 1 a flat face with a sharp crease. The result is a height in the units of each fold's height. Take its slope with fdSlope or fdCurvature for relief.
Parameters
| Name | Type | Notes |
|---|---|---|
coords | {along: Expr | number; across: Expr | number} | |
folds | Fold[] | |
opts | DrapeOptions |
Example
const cloth = (at: Expr) => drapedFolds(drape.coordsOf(at), folds, {time: t, ripple: {waves: RIPPLE}, sway: {amount: breeze}, pinning: u.pinning})
const relief = fdCurvature(cloth, q, 0.004)
Tip. Keep the wave list and swell as constants next to the definition. They are the look.
See also
foldSet— Lays out the ridges of a draped cloth:countfolds spread evenly acrossspread, each nudged sideways, widened and raised by a seeded amount so no two are alike.wavyLine— The height of an animated wavy line at a point along it: a stack of traveling sines.fdSlope— The value and slope of any field at a point:value,dxanddy.