Hello Everyone,
I have a problem in 3D :eek2: engine in API :eek2:
How I can find out what faces of some model are hidden? :confused: ex. on cube hidden faces are bottom,back and side faces?
Printable View
Hello Everyone,
I have a problem in 3D :eek2: engine in API :eek2:
How I can find out what faces of some model are hidden? :confused: ex. on cube hidden faces are bottom,back and side faces?
A fast way to determine which faces are hidden is by just looking at the normal of the face (often you need to compute it). If you do surface normal dot the camera position and its negative, it is for sure hidden since it is facing the opposite way. If its positive you need to do more checks.
There are a TON of algorithms on hidden surface removal. Theres the painter's algorithm, Z-Buffer algorithm (or depth buffer), scan line algorithm and many more. Just do a quick google for "Hidden Surface Removal Algorithms" and read/understand them.
As for the API question, I don't exactly know what you mean? You would need to explain it more. I know that in OpenGL it uses Backface removal (by using surface normals) and Z Buffer method, but you have to enable it. As for DirectX, I'm not entirely sure what it uses but I would assume it uses the same operations as OpenGL. Most graphic engines already take care of hidden surfaces and display the scene correctly.
If you actually want to make a list or something of all the hidden surfaces, you would need to implement one (or a combination) of the hidden surface removal algorithms and then you would find out what surfaces are hidden.
Try Culling?
Thanks a lot people. Algorithms are cool:wave: