-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Occlusion of shapes in 3D Mode #152
Comments
Are we drawing triangles on both the sides of a face(one on the side which is facing the user one on the side which is not facing the user ) ? Or only the outer triangle (the one which is facing the user) |
@tushar5526 , once the cone is tessellated into smaller triangles (https://github.com/p5py/p5/blob/master/p5/core/primitives3d.py#L348), all the triangles are sent to OpenGL for rendering (https://github.com/p5py/p5/blob/master/p5/sketch/renderer3d.py#L200). The problem is that, OpenGL is unable to use the depth of each triangle in the scene while rendering them correctly. Checkout Z-buffering: https://en.wikipedia.org/wiki/Z-buffering |
After poking around some more, I realized that the default |
Here are the results of transforming all line objects towards the camera before rendering: Transformation used: inv(self.lookat_matrix).dot(translation_matrix(0, 0, Z_EPSILON).dot(self.lookat_matrix))
|
In P3D mode, the shapes are not occluded according to their depth in the scene.
For example, wen rendering the cone:
To Reproduce
All the triangles of the geometry are seen. the triangles closer to the camera are not occluding the triangles farther from the camera.
The text was updated successfully, but these errors were encountered: