Home » Community » Forums » Math and Physics » Voxel Traversal Math
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Voxel Traversal Math
Post New Topic  Post Reply 
hihi!
i was reading this:
articleand trying to implement their voxel traversal technique.

i got 2 qns:

1)how did they calculate their "tMax"??
lets say i got a small cubic voxel, with a ray direction, and a starting 3d coordinate on the voxel as the ray origin.

issit like this:?
a)get min & max bounding location of the voxel
b)calculate t1 = (min bound - ray origin on voxel) / ray dir
calculate t2 = (max bound - ray origin on voxel) / ray dir
c)vector tMax = max(t1,t2)

2)also, i am not too sure of how they calculate their "tDelta"
a)issit jus the voxellength (consider a cubic form)
b)or tDelta = voxellength / tMax??

thx!
Edwinz

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I really don't know why they've bothered to write any code. Once you understand the traversal algorithm it's extremely simple, I should know I've come up with it myself for my voxel renderer. In fact I'm having trouble thinking of a different way of doing their traversal.

There are 3 neighbouring voxels a ray can hit next. As they are all orthogonal, all you have to do is check the intersection with the plane facing the current voxel.

This is done by calculating the distance to the plane(very simple as it's all orthogonal) then calculating the time it takes to reach the plane, using the relatant component of the velocity(again very simple and quick as everything is nicely aligned).

Do this for all 3 sides and you have 3 times. Now just check to see which is smallest and move the position on by that time.

 User Rating: 1087   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Yes, it's so simple. I also invented that myself for my voxel renderer.
Nothing difficult at all.
You pre-calculate values stepX,stepY,stepZ for each ray,with values that if you're stepping by stepX along ray, x coordinate are incremented by one.
Same for stepY and stepZ. You have 3 variables, let's name 'em lx,ly,lz . At each step you're selecting smallest variable,let's it be lx.
Then you do
curlen=lx;
lx+=stepX;
and curlen is length to intersection with neighbour voxel border.

 User Rating: 1634   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Any reason why you couldn't combine the octree/voxel methods? Voxels look great for small jumps, but the octree method looks better for big jumps. The majority of your space will be empty so having a fixed size voxel seems a waste, especially in outdoor areas. An octree for the large spaces and once a cutoff point has been reached switching to voxels would seem appropriate.

 User Rating: 1015    Report this Post to a Moderator | Link

Or processing more than one ray at a time? Up to a certain distance there's no reason why you couldn't. You're just collecting sets of points.

 User Rating: 1015    Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: