问题
Using the three.js library I managed to show occluded edges of a 3D object as dashed lines.
And I want edges occluded by other objects to behave the same way.
With the solution explained here it's working fine except in some strange cases.
Here's an illustration of such a case (I use an orthographic camera so we don't see how far away objects are from each other, hence the text in the picture):

Has anyone ever encountered something similar?
Any idea why in this case it's not working?
Maybe the part polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 1
in my code is misused.
Or maybe side: THREE.DoubleSide
in my material is the source of this problem. Because I've seen it has some weird behaviour with transparency.
Here's my code : http://jsfiddle.net/car3v/4/
回答1:
The object with the dashed lines with the material's depthTest: false
has to be in front in case it's occluded by a mesh of a "plain" object.
So I just set manually dashed_object.renderDepth = 9007199254740992;
which is the biggest integer possible in JavaScript and now it's working properly.
来源:https://stackoverflow.com/questions/16110716/occluded-object-with-three-js-behaving-strangely