Give a stock three.js material (a scatter plant, a banner, a field of reeds)
a wind-driven bend, so it answers the same Wind that drifts the
clouds and slants the rain.
Opt in per material, deliberately. Which scatter bends is what tells a
hedge from a boulder, exactly as attachSeasonalTint is what tells a
broadleaf from a pine — so HexWorld.setWinddrives whatever carries this
patch but never applies it for you. Call it on the plants.
The sway needs no attribute the mesh doesn't already have: height comes from
the geometry's own local Y — createBroadleafGeometry and every other shape
builder seats its plant at y = 0, which is what makes that height honest —
and the per-plant phase from the instance origin.
Three limits worth knowing. Shadows are cast through three's own depth
material, which carries none of this — a swaying tree's shadow stands still,
and at the amplitudes here that is invisible against a moving canopy but
would not be on a flagpole. A mesh whose geometry is not seated at y = 0
bends around y = 0 rather than around its base; seat it, or set
WindSwayOptions.height to match what it actually spans. And the bend
goes in at <begin_vertex>, which <skinning_vertex> later overwrites
wholesale — so this moves scatter and props, not a skinned character's cloak.
Safe on a material that already has an onBeforeCompile (the existing hook
still runs), and idempotent.
Give a stock three.js material (a scatter plant, a banner, a field of reeds) a wind-driven bend, so it answers the same Wind that drifts the clouds and slants the rain.
Opt in per material, deliberately. Which scatter bends is what tells a hedge from a boulder, exactly as
attachSeasonalTintis what tells a broadleaf from a pine — soHexWorld.setWinddrives whatever carries this patch but never applies it for you. Call it on the plants.The sway needs no attribute the mesh doesn't already have: height comes from the geometry's own local Y —
createBroadleafGeometryand every other shape builder seats its plant at y = 0, which is what makes that height honest — and the per-plant phase from the instance origin.Three limits worth knowing. Shadows are cast through three's own depth material, which carries none of this — a swaying tree's shadow stands still, and at the amplitudes here that is invisible against a moving canopy but would not be on a flagpole. A mesh whose geometry is not seated at y = 0 bends around y = 0 rather than around its base; seat it, or set WindSwayOptions.height to match what it actually spans. And the bend goes in at
<begin_vertex>, which<skinning_vertex>later overwrites wholesale — so this moves scatter and props, not a skinned character's cloak.Safe on a material that already has an
onBeforeCompile(the existing hook still runs), and idempotent.