It is currently Sat Aug 22, 2020 4:56 am


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: A Fast Voxel Traversal Algorithm
PostPosted: Thu Feb 16, 2017 3:04 pm 

Joined: Thu Feb 16, 2017 5:54 am
Posts: 1
I saw that in Raycasting.h in the function terrainRaycastWithDirection, the main loop traverses voxels by advancing fStepSize along the direction. It seems susceptible to skipping voxels, especially if the ray "grazes" the voxel. I suggest implementing a fast voxel traversal algorithm as described in the 1987 paper "A Fast Voxel Traversal Algorithm". It's similar to the Bresenham's line drawnig algorithm.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: A Fast Voxel Traversal Algorithm
PostPosted: Sun Feb 19, 2017 8:36 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Hi, a Bresenham-style line traversal algorithm is indeed used when traversing the ColouredCubeVolumes whereas the code you have identified is used for the TerrainVolume. This is because a voxel in the ColoredCubeVolume is simply on or off, but in the TerrainVolume the voxels take on a continuous range of values. So when traversing the TerrainVolume we are not looking for a solid voxel as such, but instead the point where the interpolated voxel values go above a certain threshold.

The code you were hoping to see is actually in PolyVox (used by Cubiquity) and is here:

https://bitbucket.org/volumesoffun/poly ... ast.inl-27

It's not exactly Bresenham's algorithm but I think it's the same kind of approach.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net