I have been playing with voxelization for a little time, I'm still very new to this technique. I am trying to use it for ray tracing but I've been stuck with one problem. There are some codes out there in the web that already perform voxelization however, for ray tracing I need to check the intersection between a ray and a triangle. Therefore, I've been thinking about what would be a good approach to create a list of triangles for each voxel in order to query the triangles once I know a ray hits a particular voxel? Should I try to modify the code of the voxelizer to benefit from the overlap-test or is it better to create a space-partitioning structure?

  • 3
    $\begingroup$ I don't know a lot about voxel-based rendering, but I always got the impression voxel-based raytracers intersected the rays directly with the voxels, instead of constructing a polygonal representation of the voxels first. $\endgroup$ Feb 17, 2016 at 15:14
  • $\begingroup$ Neither am I, I just read about rendering using voxelization so I might have a wrong idea on the technique. $\endgroup$
    – BRabbit27
    Feb 17, 2016 at 15:26
  • 1
    $\begingroup$ You don't want to do voxel rendering, right ? since you would no longer need triangles. You wan't to do an optimisation structure sorting the scene triangles withing regular grid cells, right ? (but there are several variants, e.g. spliting the triangles or not. which is yours ?) $\endgroup$ Feb 21, 2016 at 0:49

2 Answers 2


You could do this. Basically what you would do is generate a cube for each voxel (or actually nearby voxels could share the edges). Not exactly sure what benefit you would get form this, unless your intersection algorithm is somehow extremely finely tuned. It could be useful for real time rendering or some sort of sparse structure. While your at it why not dispense of the voxel concept altogether and go all FEM on the problem.

The thing is you want a more uniform sampling across the volumes density function. Because your integrating over a volume functions you want the step size to be somewhat equally spaced so you can control the integration better. Random or pseudo random solution converges often better, but mainly you do not do cube oriented sampling this way as it will make the structure obvious which is not your goal in most cases.

enter image description here

Image 1: Different sampling strategies. Images in RTL reading order samples along voxel grids, Uniforms sampling and jittered ray length sampling.

Think of this as solving a ODE you sample the function uniformly and if your value changes too much you might do additional samples. This is probably the reason why you wouldn't really do collision to the voxels.


Here's a very speedy 10 line maths fix for converting mesh to voxels... forget rays, dot products, square roots etc, edges, intersections do this: https://gamedev.stackexchange.com/questions/136243/how-can-i-randomly-pick-points-on-a-triangle/136250#136250


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.