Depth issue with made 3D Geometry

Hi,

I have made a function to draw a Octahedron that uses 8 ofDrawTriangle for the faces, when I call it I draw it twice, once with ofFill for the Shape and one with ofNoFill to give a “contour effect”.

Problem is that we see the lines of the faces behind through the shape (Screenshot 1), I then use ofEnable/DisableDepthTest to fix the issue but when I drop the Alpha value of the Shape color there are some weird issues where the shape doesn’t seem full (Screenshot 2)

I have tested to see if all faces are properly drawn by giving them 8 different colors and it seemed fine.

Screenshot 1:
1

Screenshot 2:
2

Actually to save time, the issue also occurs with ofBoxPrimitive and other 3D Primitive from OF.

image

in general it’s a hard problem to do depth testing and transparency – there’s some discussion here if helpful

usually I try to find a blend mode which will work or find some other solution to achieve what I need.

1 Like

Thanks I will look into it ! :slight_smile: