three.js wireframe only shape with hidden edges as dashed lines

前端 未结 2 1202
谎友^
谎友^ 2021-02-02 02:28

I\'m trying to create a specific type of 3D object in three.js. I want for example a cube in wireframe mode (so only edges shown). But I want the edges that are behind to be das

相关标签:
2条回答
  • 2021-02-02 02:57

    This is a really cool idea. I have implemented your answer as described above at:

    http://stemkoski.github.com/Three.js/Dashed-3D.html

    in case anybody wants to see it in action.

    0 讨论(0)
  • 2021-02-02 03:19

    I managed to do it. You need to create three objects.

    1st object: the solid 3d object (I mean the faces not the edges)

    2nd object: all edges but dashed

    3rd object: all edges but normal (not dashed)

    For the 1st object set the material with color: false, side: THREE.DoubleSide, depthTest: true.

    Second object material: color: (whatever you like), depthTest: false.

    Third object material: color: (whatever you like), depthTest: true.

    I also set all materials with polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 1 to get rid of z-fighting.

    0 讨论(0)
提交回复
热议问题