BirdGeometry
new BirdGeometry()Low-poly bird geometry for instanced flocking simulations. Matches the bird model from three.js WebGPU compute birds example.
Structure
- 3 triangles: body, left wing, right wing
- Total 9 vertices (3 per triangle)
Vertex Layout
- Vertices 0-2: Body (center tail to head)
- Vertices 3-5: Left wing
- Vertices 6-8: Right wing
See also
Example
import { BirdGeometry } from '@three-blocks/core';
import { InstancedMesh, MeshStandardNodeMaterial } from 'three/webgpu';
import { If, vertexIndex, sin } from 'three/tsl';
const geometry = new BirdGeometry();
const material = new MeshStandardNodeMaterial({ color: 0x0088ff });
// Animate wing flapping in vertex shader
material.positionNode = Fn(() => {
const pos = positionLocal.toVar();
// Wing vertices (4,7) flap with phase
If(vertexIndex.equal(4).or(vertexIndex.equal(7)), () => {
pos.y = sin(phaseUniform).mul(5.0);
});
return pos;
})();
const birds = new InstancedMesh(geometry, material, 1000);
scene.add(birds);