See what's going on with flipcode!


Submitted by , posted on 24 September 2003

Image Description, by

This picture shows four frames of an animation made with a ray tracer I am developing for my personal education. The shadows on the ground slide as an animated light source follows a circular path above the terrain.

The height field is not converted into a polygonal mesh, but is ray traced directly, with a technique similar to the Grid Tracing(GT) algorithm ["Grid Tracing: Fast Ray Tracing for Height Fields", F. Kenton Musgrave, 1989]. The main differences are in the 2d grid traversal and in the ray-surface interections calculations. Infact, like GT, to reduce the number of the ray-triangle intersection tests, the algorithm finds the height field cells intersecated by the orthogonal projection of the ray on the ground plane, but while GT uses a modified version of the Bresenham line drawing algorithm to scan these cells, I perform a 2d traversal of the grid like in ["A Fast Voxel Traversal Algorithm for Ray Tracing", J. Amanatides, A. Woo, 1987]. About the second difference: GT first finds the intersection point of the ray with the plane of a triangle and then, if this intersection occours, checks, with a fast test derived from the "regular structure" of a height field, if this point is in the triangle. A big disavantage of this approach is the need of the plane equation for each triangle of the height field. So I simply used the ray-triangle intersection routine described in ["Fast, Minimum Storage Ray-Triangle Intersection", T. Möller, B. Trumbore, 1997]. The vertex normals are computed with finite differences.

For the curious: the alien landscape of the video is rendered from a "unusual " height map...see the bottom link for more details.

The video can be downloaded from

Please forgive (and forget) my poor English;)

Image of the Day Gallery



Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.