I attempted to create a complex graph with over 10k edges using three.js. While LinePieces helped improve performance, I struggled to assign unique colors to each edge since only one "material" could be used for the Line object.
Below is part of the code snippet:
function drawEdges() {
edgeGeometry = new THREE.Geometry();
edgeMaterial = new THREE.LineBasicMaterial({ opacity: 0.1 });
foreach source-target node pair:
edgeGeometry.vertices.push(new THREE.Vector3(source.x, source.y));
edgeGeometry.vertices.push(new THREE.Vector3(target.x, target.y));
}
var edges = new THREE.Line(edgeGeometry, edgeMaterial, THREE.LinePieces);
scene.add(edges);
}
My query is: Is it feasible to utilize different materials when utilizing THREE.LinePieces? Any assistance on this matter would be greatly appreciated.
Thank you in advance.