3
\$\begingroup\$

This is more a conceptional (approach) question then the search for an implemented solution, since I was unable to find proper hints via google or similar.

The problem is as follows:

Given you have a 3D world that is encoded as voxels. So basically you have your 3D matrix were each position in the matrix is either solid or void ( for simplicity ). Now you look with your camera onto this cloud form a given ( in my case fixed for an isometric perspective ) angle. For each non void coordiante I draw an isometric projected block ( due to my choosen fixed camera angle ), while leaving void coordinates empty.

Of corse I want ot omit to draw coordiantes that are not vissible, so I alread exclude coordiantes that the camera would not see. But I also want to omit coordinates that would be hidden by other blocks, which are in the perspective closer to the camera.

I currently solve this by choosing a specifc camera angle that ensures that a block at coordiantes 0,0,0 would occlde a block at -1,-1,-1; -2,-2,-2; -3,-3,-3; and so on ( is that clear enought or should I add an image to explain? ). This is a rather cheap trick but it works and makes rendering faster as I have only to do a trace for each visible coordiante on the screen and draw the first non void coordinate in that trace. I saw this solution also used in Gnomoria for instance.

But I am wondering, if anyone has some keywords or hints if there is a more general approach to solve this occlusion problem without falling back using cheap camera tricks.

\$\endgroup\$
3
\$\begingroup\$

3D DDA is the algorithm used for this. It is similar to the method used for lighting occlusion in roguelikes.

\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you for the hint! Again until you don't know the name of the thing you won't find it. \$\endgroup\$ – Kailrim Oct 8 '13 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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