Self intersection artifacts in 3D image raytracing
I want to know if there is a better way to check for self intersection, other than checking the original position?


Since cubes are convex solids, a self-intersection check shouldn't introduce artefacts in your case, while it would in a more general ray-tracer (see my answer about the shadow terminator problem for more about that). In general, it's a good idea for your ray object to have a reference of some kind to the object it came from, as well as the kind of ray it is (primary, shadow, reflection, refraction). Normally the reference should be to the exact polygon, not just the whole object; in your case, it should be the particular cube. You could identify it by the co-ordinates of the cube, if you're using spatial hashing to store your voxel grid.

Then, in your intersection test, if your ray is a shadow ray, you should check whether the origin cube is the same as the cube being intersected, and discard that intersection if so.