   2d grid raycasting....how do I use a 3d grid?
  Hi!I'm writing a raycasting engine based on the tutorial here: http://www.permadi.com/tutorial/raycast/index.htmlI don't want to use a 2D grid to represent my walls. (a two dimensional array). I want to use a 3D grid (a three dimensional array), so that each grid index represents a cube.This way, I could have floating cubes (not just walls), and the camera could rotate around all axis.In order for the raycasting to take advantage of the grid layout, I'm trying to find the first X intersection, Y intersection and Z intersection from the camera to the nearest grid X,Y and Z lines....here is an illustration of what I am talking about, but in 2D:http://www.permadi.com/tutorial/raycast/rayc7.htmlThis is my question: How can I do this in 3D? Obviously rather than just finding the x and y on the point of intersection, I must find the x,y and z at the point of intersection. But in 3D the camera will have two angles...not just a horizontal rotation, but also a vertical rotation.How can I do this?I know this is a long post, but I felt I had to explain myself clearly.I'd be most grateful for any information of course! :)David :)   
  Google around for "voxel rendering." There are basically two families of voxel rendering systems: heightmap voxels (where each "cell" is really a stack of cubes on top of a virtual "floor") and general voxels, where you sculpt shapes in 3D out of tiny cubic forms. Voxel systems are basically the 3D analogue of raycasting.   