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
|
|
@ -38,6 +38,7 @@ out vec2 v_uv[];
|
|||
out float v_seed[];
|
||||
out vec2 v_rot[];
|
||||
out float v_hull[];
|
||||
out float v_quake[]; // grass does not quake; written so model.frag can read it
|
||||
|
||||
const float CELL = 16.0;
|
||||
float hash1(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); }
|
||||
|
|
@ -153,6 +154,7 @@ void main() {
|
|||
v_seed[o] = seed;
|
||||
v_rot[o] = vec2(s, c_);
|
||||
v_hull[o] = hull;
|
||||
v_quake[o] = 0.0;
|
||||
}
|
||||
}
|
||||
for (int q = 0; q < ROWS - 1; q++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue