Wednesday, July 26, 2006

fixed the level of detail seams !

Look at the seams!

st0op!d bug, returning the wrong height values at the seams, resulted in cracks. Fixed that, so the north-south connection now has its cracks eliminated. Now I need to do the textures correctly, THEN I can go to the east-west connect (+ textures), and THEN there's this little crack in the north-east corner because I don't have that neighbor (yet).

Phew, making a terrain is hard work!

Sunday, July 16, 2006

First level-of-detail


This cyber landscape is a wire-model of the heightmap I've loaded. You can cleary see the landscape being divided in 4 "chunks". Each chunk has a simple level-of-detail algorithm: if the distance between the center of chunk, and the camera is big enough, the number of "patches" for each chunk is divided by a power of 2.

Now I just need to figure out how to sew these chunks together with their neighbours, because there are wide gaps between all of 'm.

Wednesday, July 12, 2006

Everybody loves screenshots :-)


This a much more "normal", and natural-looking chunk of terrain, wouldn't you agree? This is the straight-forward one pixel = one vertex solution. The colors come from a simple texture that I sort of derived from the heightmap. The texture contains as many texels as the heightmap contains pixels. The darker lines/smudges in the fore-ground for a text. This was the easiest way to make sure the texture wasn't inadvertedly mirrored.

Now, I'd like to do shadows. For performance comparison, I will turn on dynamic lights and see the difference, and then I'd like static, but on-the-fly lightmapping for the terrain.

And then, it's up to level-of-detail ! woohoo !
This screenshot shows a JOGL application displaying a 128x128 heightmap, but with a little twist. Instead of each pixel giving the height of 1 vertex, a pixel defines the height of 4 vertices. That means I need extra quads just to weld everything together. I added the extra quads in one direction, but not in the other. You get "slices" of land!
The effect is funny, but not the least bit natural, because of the lack of sloped surfaces. Back to the drawing board :-)

However, drawing 128x128x3 quads, each containing 4 vertex coordinates and texture coordinates, is still running smoothly. I like "smooth"!

Tuesday, July 04, 2006

NextStep

Next stop = terrain rendering!
Since it is a part of so many other games, and it can be nicely isolated, it is a logical thing to be working on. It also has plenty of literature.

I'm still wrestling with a good class hierarchy for the rendering process. In my simple previous examples, all renderables implemented the same interface, and they were added to an ordered list. This flat model cannot be maintained for more complicated scenes, I think.

On another note: I've thrown up another ball about a generic 3D Model converter/loader interface. If that takes off, I'd be thrilled to cooperate.