|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Voxel Traversal Math |
|
![]() edwinnie Member since: 3/17/2002 |
||||
|
|
||||
| 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 |
||||
|
||||
![]() higherspeed Member since: 4/18/2003 From: Cambridge |
||||
|
|
||||
| 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. |
||||
|
||||
![]() Dmytry Member since: 12/9/2003 From: M 104 .... |
||||
|
|
||||
| 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. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| 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. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| 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. |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|