Skip to content Skip to sidebar Skip to footer

Hide A Face Of A 3d Shape Behind Another, Android Canvas?

Suppose that I have to draw two faces of a 3D shape in a canvas. In OpenGL, we use clockwise and non clockwise ordering of vertices to detect what face is front face and what is be

Solution 1:

The process you describe is called back-face culling (this will greatly improve your google prowess on the topic).

The straight forward way to implement is to take the normal vector of your face, and check if it faces towards or away from the camera.

You do this using the dot product of the normal and the view vector of your camera. Depending on the sign of the dot product, the polygon is facing towards or away from the camera.

If you don't actually have a camera at this point, substitute a vector into the screen (i.e. [0, 0, 1] or [0, 0, -1] depending on your axis system).

Solution 2:

Do you looking for 3D Flipping? If so, then I suggest you look at this link and this one. Also there is some other related questions on StackOverFlow and other blogs. Just search "3D Flip on Android" on Google.

Good luck!

Post a Comment for "Hide A Face Of A 3d Shape Behind Another, Android Canvas?"