Rendering large terrains in WebGL

Felix Palmer - @pheeelicks

Rendering large terrains in WebGL

Felix Palmer | @pheeelicks | www.pheelicks.com

Talk overview

  1. Crash course on WebGL shaders
  2. Basic approach to problem
  3. Using a recursive tile pattern
  4. Using a dynamic mesh
  5. Questions? Feel free to ask during talk too!

Talk is based on blog post that can be found on www.pheelicks.com

DEMO

felixpalmer.github.io/lod-terrain/

WebGL graphics pipeline

  1. Geometry is defined in JavaScript and sent to GPU
  2. Vertex shader is invoked on every vertex, allowing it to be moved
  3. Fragment (pixel) shader is invoked on each pixel to be drawn

In this talk we'll be looking at the geometry and the vertex shader

Let the graphics card do the work!

Simple grid approach

DEMO

Arrange tiles in concentric shells

Arrange tiles in concentric shells

DEMO

Moving around the terrain

DEMO

How to fix shaking

Seams between layers

DEMO

Morphing grid snapping between layers

DEMO

Questions?

http://www.github.com/felixpalmer/lod-terrain

http://felixpalmer.github.io/lod-terrain/

Felix Palmer | @pheeelicks | www.pheelicks.com