Sign in to follow this  
Quat

ray tracing/octree

Recommended Posts

Quat    568
Hi, I am implementing an octree acceleration structure for my triangle based ray-tracer. I use the algorithm described in "Advanced Animation and Rendering Techniques" by Alan and Mark Watt. Background: Basically, for a ray, I find which leaf voxel the ray origin is in. Then I test the ray against all triangles in that voxel. If no intersection occurs inside the voxel, then I move the ray position such that it now barely lies in the next voxel in the ray's path. This continues until an intersection happens or the ray exits the root voxel volume. Problem: The ray position lies on the boundary face of two voxels (see http://img218.imageshack.us/img218/4563/octreevb5.jpg). Thus when I do the query to see which voxel the ray position lies in, only one of the two voxels is returned, namely Q3 in the figure. This is a problem if the ray aims inside the other voxel, as the RayAABB(ray, Q3) test will turn up empty, thus causing my code to think the ray has exited the voxel space of the root. You might say that the ray intersects Q3 at t = 0. But I made my ray intersection code to only look for intersections in [t_min, t_max] to avoid self intersections and such. So the t = 0 intersection won't be caught. Any nice ways to handle this situation?

Share this post


Link to post
Share on other sites
rapso    180
Quote:
Original post by Quat
Hi,

I am implementing an octree acceleration structure for my triangle
based ray-tracer. I use the algorithm described in "Advanced Animation
and Rendering Techniques" by Alan and Mark Watt.

Background: Basically, for a ray, I find which leaf voxel the ray
origin is in. Then I test the ray against all triangles in that voxel.
If no intersection occurs inside the voxel, then I move the ray
position such that it now barely lies in the next voxel in the ray's
path. This continues until an intersection happens or the ray exits
the root voxel volume.

Problem: The ray position lies on the boundary face of two voxels (see
http://img218.imageshack.us/img218/4563/octreevb5.jpg). Thus when I do
the query to see which voxel the ray position lies in, only one of the
two voxels is returned, namely Q3 in the figure. This is a problem if
the ray aims inside the other voxel, as the RayAABB(ray, Q3) test will
turn up empty, thus causing my code to think the ray has exited the
voxel space of the root.
I dont really understand why this happens, 'cause after your code assumes it does not hit anythin int Q3 it should
Quote:
If no intersection occurs inside the voxel, then I move the ray
position such that it now barely lies in the next voxel in the ray's
path.
so the next query should lie in Q4 and everything should workout. Am I missing somethin?


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this