feat(render3d): an aspen quakes, and a tree is no longer bent like a bow
layer_flutter(l, v) gives a scatter layer a per-leaf tremble. The vertex stage offsets each leaf by a phase taken from its own place on the card, so neighbouring leaves are never in step, and writes the result out as a varying the fragment stage uses to flash the leaf's pale underside as it turns - which is the part that reads, since a still frame of a tremble is a still frame of nothing. One uniform, one varying, no extra pass. And the sway itself was measured in METRES: hgt * hgt * 0.35 is right for a 40 cm flower and puts ten metres of sideways into a 14 m trunk, so every tall tree in the valley stood bent over like a fishing rod. It is a fraction of the model's own height now - the tip moves a few per cent of the tree whatever the tree is, and the base does not move at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
4975c60ac1
commit
ab6f310013
47 changed files with 99 additions and 19 deletions
|
|
@ -21,6 +21,7 @@ out vec2 v_uv;
|
|||
out float v_seed;
|
||||
out vec2 v_rot;
|
||||
out float v_hull;
|
||||
out float v_quake; // only aspens quake; written so model.frag can read it
|
||||
void main() {
|
||||
mat4 m = u_model;
|
||||
if (u_skinned > 0.5) {
|
||||
|
|
@ -43,6 +44,7 @@ void main() {
|
|||
v_seed = 0.0701;
|
||||
v_rot = vec2(0.0, 1.0);
|
||||
v_hull = 1.0;
|
||||
v_quake = 0.0;
|
||||
#ifdef SHADOW_PASS
|
||||
gl_Position = u_light_vp * w;
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue