My first terrain renderer

I’ve made a non-webstartable zip-file, including jogl and the windows dll’s.

Any comments at all are more than welcome 8)

features:

  • chunked LOD
  • 1 chunk = 64x64
  • 4x4 chunks
  • simple LOD algorithm (based on 2D distance from centre-of-chunk to camera, height does not count)
  • 1 single texture for every chunk (to downsize demo and because I don’t have texture mgmt)
  • normally, one texture per chunk (no multi-texturing) with red edges to find chunk edges
  • direct-mode passing of all data (no display lists, no vbo)
  • 1 dynamic light, just to enhance landscape features a bit

keys:

  • arrows = navigate
  • CTRL+arrows: yaw/pitch
  • Q/W = change the height (I’m on AZERTY, so you may need to press A/Z)
  • A/Z = change FOV (same remark)
  • D = print debug, including FPS
  • T = toggle wireframe

Known issues:

  • fps is calculated based on currentTimeMillis(), and is only updated every second (to compensate for lack of accuracy)
  • popping
  • performance (init is slow, + very inefficient storage of heightmap)
  • ridiculous memory consumption

TODO:

  • compare display lists / VBO
  • geomorphing?
  • multi-texturing (will allow pre-rendered lightmap)
  • refactor my chunked code into something actually usable

Fire it up ! ;D

cough LINUX! LINUX! cough

:smiley:

I solemnly promise, if (when?) I ever get around to making my killer super-duper game that is going to make me rich, I’ll include the linux binaries as well. :stuck_out_tongue:

in the meantime:
http://users.pandora.be/bart.huylebroeck1/opengl/terrainLOD.jpg

Quite nice! Did you know that in chunked-LOD the chunks are cLODed ? That is, independant of camera-position (distance) and orientation.

It really shouldn’t be hard to keep the data in vRAM, displaylists are your easiest pick, VBOs would be better if you’d want to implement morphing later on.

Prerendered lightmaps (or normal-maps) are indeed required of you don’t want the poor shading of vertex-lighting of LODed geometry, that tends to get really ugly.

You’ll find that once you keep your data in vRAM, performance will get a very serious boost, allowing to use terrain of 16x16 chunks or even more. Combine that with frustum-culling (on a per-chunk basis) and it can’t get much more efficient.

Good luck!

The camera movement is very nice.

I need to read up on chunked lod but you probably also need some kind of error metric to decide which level of the lod to show.

Also a webstart version would be nice, you can easily include the jnlp file from the jogl website.

Koen