Abstract

A fast and simple voxel traversal algorithm through a 3D space partition is introduced. Going from one voxel to its neighbour requires only two floating point comparisons and one floating point addition. Also, multiple ray intersections with objects that are in more than one voxel are eliminated. Introduction In recent years, ray tracing has become the algorithm of choice for generating high fidelity images. Its simplicity and elegance allows one to easily model reflection, refraction and shadows. Unfortunately, it has a major drawback: computational expense. The prime reason for this is that the heart of ray tracing, intersecting an object with a ray, is expensive and can easily take up to 95% of the rendering time. Unless some sort of intersection culling is performed, each ray must intersect all the objects in the scene, a very expensive proposition. There are two general strategies for intersection culling: hierarchical bounding volumes 2, 3, 4 and space partitioning. 6, 7, 8 The general idea of the first approach is to envelop complicated objects that take a long time to intersect with simpler bounding volumes that are much easier to intersect, such as spheres or boxes. Before intersecting the complicated object, the bounding volume is first intersected. (Actually, it is not a full intersection test; all we care about is if the ray hits the bounding volume, not where). If there is no intersection with the bounding volume, there is no need to intersect the complicated object, thus saving time. For a complicated scene made up of many objects, a bounding volume is placed around the entire scene with each object also containing a bounding volume. If an object is made up of several parts each of these parts can also have a bounding volume. We thus can built a tree of bounding volumes, with each node containing a bounding volume that envelops its children. Objects within a subtree are intersected only if their parent node bounding volume is intersected by the ray. In this manner, the amount of actual intersections are significantly reduced. Of course, we now hav e to spent time intersecting bounding volumes but this is more than offset by the reduced total intersections. The second approach of reducing intersections is to partition space itself into regions or voxels. Each voxel has a list of objects that are in that voxel. If an object spans several voxels it is in more than one list. When a ray is shot, we first look into the voxel in which it originates. If it hits any objects in the starting voxel’s list, the intersections are sorted and the closest one is retained. If the intersection is in the current voxel there is no need to intersect any other objects as we have found the closest intersection. If no intersection is found in the current voxel or the object list is empty, we follow the ray into a neighbouring voxel and check its object list. We continue until either we find an intersection or we completely traverse the space partition. Since we intersect objects roughly in the order as they occur along the ray and trivially reject objects far from the ray, the number of intersections that need to be performed is vastly reduced. There are two popular space partition schemes: octrees by Glassner, where voxels are of different sizes, and constant size voxel partitioning (hereafter called a grid partition) by Fujimoto et. al. 8 The first conserves space but makes traversal difficult while the latter allows for simpler traversal at the expense of more voxels. In this paper, we introduce a fast and simple incremental grid traversal algorithm. Like Fujimoto et. al., 8 it is a variant of the DDA line algorithm. However, instead of basing it on the simple DDA (Fujimoto et. al.), in which an unconditional step along one axis is required, ours has no preferred axis. This considerably simplifies the inner loop and allows for easy testing of an intersection point to see if it is in the current voxel. Along with the the new traversal algorithm, we introduce a technique to eliminate multiple intersections when an object spans several voxels. This technique can be used with all space subdivision algorithms with minimum modifications. The New Traversal Algorithm Let us derive the new traversal algorithm. We consider the two dimensional case first; the extension to three dimensions is straightforward. Consider figure 1:

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.