I’ve worked on various aspects of the terrain system since last time.
Level of Detail:
The LOD system determines when a chunk should split, but I can’t just let every chunk split just because it is close enough to the camera to do so, as this would result in a whole lot of chunks trying to generate at once, and create a massive stall. Instead I assign a score to each chunk that wishes to split-the score is based its depth in the quad tree, how close it is to the split point, and if it is visible-and send off only the best scoring chunks to be split. This generation runs in a threaded job system so it scales to however many cores are available.
Here is a screenshot of the terrain, with each LOD colored differently.

Performance
Performance wise I also discovered that the data type I had been using in the vertex format for my terrain normals was quite slow, apparently using signed uchars/ushorts with normalize set to true (using glVertexAttribPointer() ) is not the fast path, instead I’ve switched to using unsigned uchars/ushorts and just subtracting 0.5 in the vertex shader. This one change basically doubled my FPS. It would be really great if the drivers would actually give some indication of this instead of having to resort to trial and error(and for all I know this is just a problem found only on my 6800..).
Randomness
I was originally using 256 element look up table for the random gradient, as is used in perlin 3D noise(except I used 3 of them, one for each axis), and although I couldn’t really visible see the repetition, it still seemed prudent to try and reduce the repetition as much as possible so I fiddled around with some various integer hash functions.
Integer Hash: this site had some nice integer hashes.
At the moment I’m using a mix of integer hash and perlin LUT by offsetting the hash by the value in the LUT. I probably need to go over this again at some point, but believe the terrain does look more “random”.
Lighting & Marching Cubes Issue
Another thing I’ve been playing with is the lighting of the terrain; I’ve tested out a whole bunch of ways to generate the terrain normals, and in general it seems to be a tradeoff between smoothness and detail. Using sobel filter type methods I can get extremely smooth normals, but they lack fine details, while using central difference the detail is better but some sharp edges on the terrain appear jagged. This jagged edge effect is a result of my current implementation of marching cubes, which is based on marching cubes 33. MC33 solves the ambiguity problems in MC but does not allow for sharp edges(it creates rather ugly zigzags where sharp edges exist). Since I’m largely using ridged noise which is all about sharp edges to generate my terrain, the result is plenty of zigzags are visible on the terrain.
Thankfully there are a couple of newer, improved marching cubes algorithms which solve the
sharp edge problem. Unfortunately they are quite abit more complex then standard MC.
Cubical Marching Squares: This one apparently solves the sharp edge problem by further subdivision, not sure that is what I want..
Dual Marching Cubes: This is a much nicer paper, the algorithm is explained well enough and I think I will try and implement it at some point. As a bonus it would drastically reduce my triangle count since it removes triangles in flat areas.
I’ve implemented a few different lighting models, originally I was just using Blinn, but I was curious how some of the other models would look for terrain. So far I’ve only tried OrenNayar & CookTorrance, since I don’t currently have tangent information available in the shader (I’ll eventually add it for normal maps I expect) as is require by some of the models. The two screen posted below use Oren & Cook respectively.
Terrain Formation:
I also fiddled around with some alternative algorithms for generating the terrain to try and create some different looking shapes. So far I’ve found methods for creating…
Blockworld: Looks like a bunch of chipped stone slabs all stacked on each other. This could possibly be used to create a cracked/slab like appearance for some stone shapes near the surface.
Mounds&Craters: One of the algorithms I made creates irregular shaped mounds mixed in with craters/lakes. I’ve mixed this in with some ridged noise and it seems to work fairly well, although not terribly realistic it does add some variety to the terrain. I’m not really focused on creating realistic terrain, I just want something that looks interesting, so I’m alright with the lakes not having rivers leading into them…and rivers are close to impossible with procedural methods.
Here is a screenshot showing a Mound like shape mixed in with multi-fractal ridged noise. This is also using OrenNayar lighting so supposedly it should look clay-like. I have the normals set to detailed as apposed to smooth so some zigzags are visible.

And here is a shot taken using the CookTorrance model, supposed to be nice and glossy which obviously doesn’t suit terrain but whatever. Also very jagged as the normals are set to detailed & this shot has many would-be sharp edges.
