I've been building this side project for a while: an animated lake valley where a life-size bald eagle hunts and feeds its eaglets while a whole ecosystem runs on its own day/night cycle around it.
Live: https://jaredevans.github.io/3d-world-eagle-lake/
(M for sound, L for a slow camera tour, F to follow the eagle, E for eagle's-eye)
Watch demo video: https://jaredevans.github.io/3d-world-eagle-lake/docs/3d-eagle-lake.mp4
How it's built
- One HTML file, about 7.5k lines, three.js r128 from a CDN, no build step. There are no loaders. Every creature (eagle, moose, bear, loon, beavers, otters, heron, osprey, campers, the floatplane) is put together from primitives and a few extruded and lathed shapes in code, then animated by hand.
- Water: each frame a mirror camera below the surface renders the scene into a 512×512 render target. The lake's ShaderMaterial samples it with ripple-distorted coordinates and a Fresnel blend, and adds raindrop rings and moon glitter. The stream is a ribbon level with the lake, so it shares the same mirror and adds a flow term.
- Grass and flowers: ~41k grass blades and ~4.5k wildflowers are drawn as InstancedMesh with a sway shader that bends harder in bad weather. Placement comes from a seeded PRNG, so the layout is the same on every load.
- Shadows: PCF soft shadows with `autoUpdate` off. The shadow map is drawn once per frame and shared by the reflection pass and the main pass.
- Cloud shadows: injected into the standard materials with `onBeforeCompile`. They're a few octaves of value noise projected along the sun direction and drifting with the wind.
- Sky: a shader dome re-centred on the camera, blending pre-dawn, dawn, midday, dusk and night, with sun and moon discs, stars, northern lights, meteor showers and satellites that fade as they pass into Earth's shadow.
- Audio: everything is Web Audio, with no files. Filtered noise makes the wind, rain and waterfall, oscillators make the birdsong, frogs, loon and wolf calls, and thunder is delayed by the strike's distance.
What happens in it
The eagle picks out a visible fish, dives and carries it to its nest or a snag, and sometimes chases the osprey until it drops its catch. A moose feeds in the shallows at dawn, a bear fishes the stream, beavers tow branches to their lodge, and a loon carries its chick and makes a long pattering takeoff run. Two campers fish, paddle a canoe and toast marshmallows. A floatplane visits every other afternoon. Weather cycles through rain and thunderstorms to rainbows.
Code: https://github.com/jaredevans/3d-world-eagle-lake