Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

A Fast Voxel Traversal Algorithm
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=23&t=694
Page 1 of 1

Author:  zyxstand [ Thu Feb 16, 2017 3:04 pm ]
Post subject:  A Fast Voxel Traversal Algorithm

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.

Author:  David Williams [ Sun Feb 19, 2017 8:36 am ]
Post subject:  Re: A Fast Voxel Traversal Algorithm

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.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/