Heya! In my force graph, we routinely get up above 400k edges and 100k nodes. Obviously this ends up lagging quite a bit, but we've already stripped out most fancy graphics and etc.
By far and away the largest impact to performance is the extremely high number of draw calls, so I've been trying to implement instanced meshes for these.
Unfortunately, I think this might be impossible without branching out my own version of three-forcegraph. Is that the case?
Here's a very, very rudimentary example of what I've been trying:
const nodeMaterial = new THREE.MeshLambertMaterial({ color: '#FFFFFF', transparent: false });
const nodeGeometry = new THREE.SphereGeometry();
const nodeInstance = new THREE.InstancedMesh(nodeGeometry, nodeMaterial, 100000); // placeholder #
let nodeIndex = 0;
const nodeMatrix = new THREE.Matrix4();
const getNodeComponent = (node: any) => {
nodeIndex++;
return [problem]
};
The main issue is that instanced meshes make use of the .setMatrixAt function to actually function. It seems like this is embedded pretty deep in the stack of force graph repos, but would be an otherwise simple change. I'd appreciate any guidance and/or confirmation that this is/isn't possible. Thanks so much, I love the repo & the work you do across all these amazing resources.
Heya! In my force graph, we routinely get up above 400k edges and 100k nodes. Obviously this ends up lagging quite a bit, but we've already stripped out most fancy graphics and etc.
By far and away the largest impact to performance is the extremely high number of draw calls, so I've been trying to implement instanced meshes for these.
Unfortunately, I think this might be impossible without branching out my own version of three-forcegraph. Is that the case?
Here's a very, very rudimentary example of what I've been trying:
The main issue is that instanced meshes make use of the .setMatrixAt function to actually function. It seems like this is embedded pretty deep in the stack of force graph repos, but would be an otherwise simple change. I'd appreciate any guidance and/or confirmation that this is/isn't possible. Thanks so much, I love the repo & the work you do across all these amazing resources.