Terrain ray tracing

The image below shows the result from my kd-tree based heightmap traversal for terrain rendering. I alternately split the terrain in two in either the x- or z-directions. Each node in the tree stores the minimum and maximum height of the terrain in that node. This gives a very tight fit to the terrain, so when an intersection check against a terrain triangle is done the hit probability is rather high, and only a few triangles per ray need intersecting.

The heightmap and texture represent the Puget Sound area, and can be found at the Large Geometric Models Archive.

Terrain Guided Multi-Level Instancing of Highly Complex Plant Populations
Large Geometric Models Archive


Coherent grid traversal

Last week I implemented the grid traversal approach from "Ray Tracing Animated Scenes using Coherent Grid Traversal". For me it was a good crash course in coherent ray tracing using ray packets, and I got some experience in implementing SIMD packet traversal and triangle intersection. I got a pretty nice speedup as well, as the table below shows. I haven't implemented coherent ray tracing for the BIH yet, but that shouldn't be too hard.

TrianglesMono gridMono BIHCoherent grid
Asian Dragon7.2M0.181.030.35

The table shows the frame rates achieved with the different approaches at 800x800. All except the hand model are from The Stanford 3D Scanning Repository (note no animations this time). In the table, "mono" refers to tracing one ray at a time, whereas "coherent" means tracing 4x4 rays at once in a coherent fashion. Note also that only the coherent version is optimized with SIMD using SSE intrinsics. Using a coherent grid traversal versus a single ray grid traversal gives me a 2x-3x speedup currently. An interesting thing to note from the table is that the BIH traversal is much less affected by the model complexity than the grid traversal. In fact it seems that the BIH tree quality is of higher importance than the model complexity.

Ray Tracing Animated Scenes using Coherent Grid Traversal
The Stanford 3D Scanning Repository