I started out making a grid comprised of regions, each subdivided into areas, further subdivided into terrain squares. I then made (a very inefficient) world generation class to iterate through all these terrain squares and assign them a different height (basically, I shove a load of sine waves onto the landscape with varying amplitudes, it looks very silly until the sine waves start overlapping, then the interactions between the sine waves start to produce something approaching believable.
Next came lighting, and I remembered (horror of horrors) that you need to specify normals at each vertex of the terrain, which is done by averaging the surface normals of all the quads surrounding a terrain vertex. Nonetheless, by the end of day one, I had a lit, hilly landscape. Albeit a blue one.
Most of day 2 was spent trying to find a simple way of adding terrain textures, it turns out that there is a very simple way, and I'm glad I took the time out to find it:
Texture tex ;
tex = TextureIO.newTexture(new File("Ground.png"), true);
Of course, I'm going to have to move this out of the init() function when I want to use more than one texture... But in any case it works. Finally, I added culling so any regions outside of the viewport aren't drawn, cutting down on rendering times. By the end of the second day, then, it was looking like this:
Remember I'm using a subdivided system of regions, areas and the rendered terrain squares. To further optimise, I added an algorithm to give the corner of each area its own vertex, and I moved the height of these vertices to match the height of the nearest terrain vertex. In effect I had created a low detail version of the rendered terrain. Then all that was required was to render the more detailed terrain closer to the camera, and render the less detailed areas further from the camera, reducing the number of triangles rendered overall. This effectively allowed me to greatly expand the size of the terrain, and still have it render at reasonable speed. Finally I added fog, which didn't take me too long at all, to get something looking a little more atmospheric:
Well... When I say atmospheric, perhaps depressing is a better word... To inject some new life into the world, I spent the 4th day adding the skybox (actually I spent most of the day adding model support). This is basically a textured sphere that I flattened into a pancake (not the most efficient method, but very quick), this way the fog doesn't obscure the sky above, but fades seamlessly into the sky. I also added a blue tint to the fog so it looks more like haze on a cloudless day than miserable English fog..
You might notice the sky has pixelation on a geographic scale, this is due to the fact I still haven't actually added support for multiple textures.. Yes, that's right, its the ground texture coloured blue!
So... 4 days into the creation, and just about everything is in place. Now I've hacked out the majority of the model loading code, vibrant tree'd (even inhabited) landscapes can't be far away...
To conclude... I've basically done this before in DirectX many years ago, but I'm quite impressed with how JOGL handles everything. Its a little more difficult for me to get my head around managing resources like models and images (something that DirectX manages quite well on its own), but performance wise its working like a charm, and creating it on my netbook has been very pleasing. Its the added portability of Java is the icing on the cake for me though, and I had my fledgling program running on linux with no troubles at all.