yourYour triangles might be specified in a clockwise order instead of WebGL's preferred counter-clockwise order. To verify, switch your material side to THREE.FrontSideTHREE.FrontSide
and run it again with THREE.BackSideTHREE.BackSide
and see if one gives you the correct results. IfIf the THREE.BackSideTHREE.BackSide
works, then you have to go back and flip your ordering in all the Face3Face3
creations.
Regarding shading looking similar with stacked objects, Three.js: three.js does not take other objects into account when lighting each object in the render stage. Let'sLet's say you wanted to make a Minecraft clone with a bunch of boxes all stacked on top of one another. Well, three.jsthree.js will calculate each individual box's lighting as if it were the only one in the world. EvenEven if you stack them densely on top of each other, they will all look the same - light on top, dark beneath.
The lighting effect you are probably wanting is achieved by ShadowMaps in three.js three.js. Shadowing portions of an object that are obscured by other objects is a complex and expensive task which is still being hashed out by the creators of three.jsthree.js.
The normal ShadowMap mode in three.jsthree.js looks okOK for now however and it works in most cases. Hope this helped! :)