r/GraphicsProgramming • • 25m ago

I wrote a custom WebGL2 terrain, weather & ecosystem engine from scratch in Vanilla JS (no Three.js) — live 3D map slices with Transform Feedback grass, 2.5D GI, and a bird flight mode

I've been working on a WebGL2 terrain & environment renderer built from scratch in pure JS/GLSL ES 3.00 (no Three.js or external 3D engines) that runs inside a Leaflet-based mapping app.

You pick any spot on Earth, and it builds a live 3D cutaway slice from real elevation, canopy height, land-cover, weather, and OSM vector data.

### Technical highlights from the rendering pipeline:
* **2-Pass 2D Relief + 3D Slice:** Uses a G-Buffer + Bake-Pass architecture to avoid recomputing heavy procedural noise/normals every frame during sun/time scrubbing.
* **Transform Feedback Instancing:** Tree LOD bucketing, faceted 3D rock placement (with exact triangle collision), and a 3-cascade GPU-clipmap for animated grass & wildflowers use Transform Feedback (`VS_GRASS_STATIC` → `VS_GRASS_STATE` → `VS_GRASS2`) with Bayer dithering transitions and horizon/frustum culling.
* **2.5D Global Illumination & Lighting:** Traces 8-direction terrain + canopy horizon occlusion and surface bounce into an offscreen GI buffer, combined with SunCalc astronomical sun/moon phases, alpenglow terminator climbing, and atmospheric sky/reflection baking.
* **Dynamic Water & Weather:** Morphological bathymetry, river flow-map advection, wind-driven waves with surf/backwash foam, seasonal lake/river freezing, orographic creeping valley fog that steers around mountain ridges, rain/blizzard particles, and fractal 3D lightning with localized flashes.
* **Procedural Assets & Tools:** Zero external 3D models — all 10+ tree species (3 LODs), rocks, bridges, and birds are generated procedurally in JS (`TreeCore` + custom in-app Tree & Bird editors). Includes frame-by-frame WebCodecs `.webm` video capture.
* **Using Gemini AI

7 Upvotes

7 comments sorted by

•

u/AutoModerator 25m ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.
  • Disclose AI usage in post or project.
  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

8

u/Fintaman 18m ago

You didn't write shit. What has this subreddit become

3

u/blackrack 6m ago

Yawn another AI project