DEV Community

Pratyush Shivam
Pratyush Shivam

Posted on Originally published at pratyushshivam.com on

One night in the Amazon rainforest in a browser tab: real forest, real animals, real sound

Understory is the floor of Yasuní, Ecuador, from 17:45 to 06:25, with one torch. Every frame of this film is the game running.

The engineering

  • The forest. 702 trees per hectare and 10.3% stilt palms, from the 25-hectare Yasuní plot, with heights from Feldpausch's fitted curve for western Amazonia. About 2,400 trunks, 5,400 plants and 560 animals, instanced: one draw call per species and per chunk.
  • The light. One torch, held at your eye, so every shadow hides behind what casts it. No shadow maps. Mist in the beam, dawn shafts, tone mapping and grain are one full-screen pass with 14 ray-march steps. If the frame rate drops, resolution goes first.
  • The eyes. Eyeshine is your own torch coming back: 1/d² on the way out, 1/d² on the way back, scaled by pupil area and the reflecting layer behind the eye. No reflecting layer, no shine. Computed per eye by the same function the tests check.
  • The sound. 25 real field recordings from xeno-canto, each played from where its animal sits through an HRTF panner. −6 dB per doubling of distance, plus a forest absorption curve that takes the high notes first, so a howler carries across the whole site and a katydid fades within tens of metres.
  • The ecology. 58 species, each with a record from Tiputini or Yasuní, at its real height and only in its own hours. Placement, activity windows and dawn order are unit-tested: 52 tests.
  • Deterministic. Every night is seeded. Night 7 is the same trees, the same animals and rain at the same minute, for everyone.

The README lists what is not real right next to what is.

No server. No tracking.

Walk in: pratyushshivam.github.io/understory/

Source: github.com/pratyushshivam/understory

I'm Pratyush Shivam, CTO of Konfidio. More of what I build and write is at pratyushshivam.com.

Top comments (0)