spite / THREE.MeshLine

Mesh replacement for THREE.Line
MIT License
2.14k stars 381 forks source link

2 Vertice but Long Line Issue #47

Open xamino opened 7 years ago

xamino commented 7 years ago

Please see this fiddle and rotate the camera around the Y axis: http://jsfiddle.net/1xsy5e90/4/ . The top line should vanish after some rotation and the bottom one will "flicker".

We encountered this issue because we have the user draw a "measurement" which is a MeshLine by selecting start and end point. If you use these to create a MeshLine you get a very long edge which vanishes for certain camera rotations.

I tried adding a single vertex in the middle (manual subdivision) and it causes the flickering at the moment where the first line vanishes entirely (but at least it remains visible). Adding more subdivisions reduces the issue until the LineMesh is drawing as expected again.

In our case we have now solved it by subdividing the MeshLine in our code so that we get a minimum amount of vertices which seems to always work so far (basically we guarantee that no two vertices are further than one unit apart, where a unit is some arbitrary magic number which solves it for us).

I'm not sure if it is a bug, but a warning at least somewhere would be nice if this is working as intended.

Thank you!

cnspaha commented 6 years ago

Not quite sure if it is the same problem than you have but I have a similar problem. I have drawn a grid consisting of one single MeshLine, but when I move the camera many lines begin to flicker.. (see image below) 2017-11-02_10-20-39

If I draw each "line" of the grid as single MeshLine I don't get the flickering but big performance issues, since there are a lot of lines resulting in a lot of objects, if I don't pack them all into one geometry.

@spite
Is my case with the grid meant to be supported? Because of the Shape Example I thought my case should be also fine since there is also only one single geometry with a lot of points connected to each other, like in my case.