Ehm… To be honest, I don’t know what to say. The deeper I dive into the depths of conjunction of three.js and canvas’ 2d-context, the more clearly I feel how the darkness consumes me, and there is no way back
Joking, of couse (maybe)
The core of this work is the using of .project() method of Vector3 object (line 161, in the draw() method of Mesh class), and depth sorting at the level of positions of objects in the scene.
The main differense from this scene is that I tried to use a material with simple lighting model (directional and ambient lights).
Interesting approach. There is a lot of things to dive into and to learn from. It looks as if you have extended/reimplemented a lot of Three.js classes.
Check the sign of a face/side area in screen coordinates, and if it’s less than 0, don’t draw the face/side (lines 182-188). For simplicity, I take first three vertices in count.
Pretty much like gl_FrontFacing works.