Patent ID: 8289324

Claim:
A method, comprising: initializing a first stack of bits to include only one bit per level of a spatial hierarchy, the first stack of bits initialized such that a most significant bit of the first stack of bits is set to a first value and all other bits of the first stack of bits are set to a second value; traversing, utilizing a processor, the spatial hierarchy for tracing a ray; storing, in the first stack of bits, a number of nodes traversed in each of a plurality of levels of the spatial hierarchy; setting the most significant bit of the first stack of bits to the second value as a result of storing, in the first stack of bits, the number of nodes traversed in each of the plurality of levels of the spatial hierarchy; detecting that the most significant bit of the first stack of bits is set to the second value; and terminating the traversal of the spatial hierarchy in response to the detection of the most significant bit of the first stack of bits being set to the second value; wherein the number of nodes traversed in each of the plurality of levels of the spatial hierarchy is stored regardless of whether the nodes are intersected by a ray.