THREE.MeshLine icon indicating copy to clipboard operation
THREE.MeshLine copied to clipboard

Merging geometries

Open dhritzkiv opened this issue 9 years ago • 5 comments

I had the idea of generating lots of lines (that have the same material properties), and merging them for use in one single Mesh in order to reduce the number of Mesh objects added to the scene (and therefore the number of draw calls).

However, simply trying that yielded… no results. (still, it was worth a shot) :)

Anyway – would it be possibly to perform a merge on MeshLine geometries? Or is it limited by how these lines work?

dhritzkiv avatar Dec 18 '15 04:12 dhritzkiv

Maybe this could have a .toBufferGeometry() method?

mrdoob avatar Dec 18 '15 16:12 mrdoob

The problem is that each line is a sequence of vertices (it's expanded into a strip of triangles).

How could one single geometry be drawn in split lines? I can't think of a way

spite avatar Dec 18 '15 16:12 spite

I guess if you used tubes instead of polys that needed to be rotated towards camera...

makc avatar Dec 18 '15 18:12 makc

i'd need support for merged discontinous lines too. Basically what THREE.Linesegment does. It repeats the vertices in the array, like 0 1, 1 2, 2 3, ...

Will this be possible?

FrederickDesimpel avatar Jul 29 '16 13:07 FrederickDesimpel

Frederick's suggestion is probably the best, but personally I dealt with discontinuous MeshLines by hiding the desired segments. Add a bufferAttribute for vertex visibility and pass a positive alphaTest in MeshLineMaterial.

Posted some code in #34 if you like.

Quick and dirty :+1:

Clotoo avatar Jun 21 '17 14:06 Clotoo