Is it possible to merge multiple disconnected lines in three.js?

three.js

Solution

You can render multiple line segments with a single draw call by using `THREE.LineSegments`:

var line = new THREE.LineSegments( geometry, material );

three.js r.107

Problem

I am working on a graph visualization project and there is a performance problem, because the nodes are connected through simple lines, where each edge is represented by a `THREE.Line`. This causes too many render calls. One possible solution would be to use a `THREE.Line` for each connected component, but I was wondering if there is a more general solution. In three.js it is possible to merge multiple geometries into a single geometry, but is there also a way to merge multiple disconnected lines into a single geometry?

Original source

Related problems