One of the homework assignments for our Graphics course was to implement a terrain renderer using a quadtree structure. After reading up on it a bit, I attempted to implement the method described by Ulrich’s article (although I won’t lie: the working demo code given in the article helped a good deal with that part). The image above is the end result of the terrain renderer, along with the quaternion-based camera library I implemented for the previous assignment.
The random terrain in this example was created by generating a 1024×1024 image in GIMP using the Solid Noise filter and saving it as a PNG, which Terra uses to generate the heightmap. The image used to texture the terrain was created by applying a gradient map to the grayscale heightmap, and adding an embossed version of the grayscale heightmap on top of the gradient mapped heightmap to give the illusion of a directional light source.
The inset image is the same scene as the first image in this post, but rendered in wireframe mode. If one looks closely, one can see how the adaptive quadtree algorithm uses more triangles for high-detail parts of the heightmap, and less (”bigger”) triangles for less detailed parts.
Finally, the last image below is also the same scene as the other two images, but with a detail factor 2ΒΌ times higher than the first two images, also rendered in wireframe, highlighting the increased number of triangles.
Tags: programming, University


