Using LineSegmentsGeometry + LineMaterial in an instanced mesh

Hi! I’m trying to replicate https://discourse.threejs.org/t/use-edgesgeometry-in-an-instancedmesh/16723/4 but using LineSegmentsGeometry, LineMaterial, and LineSegments2.

LineSegmentsGeometry is a InstancedBufferGeometry under the hood, so I figured it wouldn’t be too hard, but the LineMaterial shader is blocking me. Essentially, I’m trying to find the equivalent of transformed += offset; in the different shader.

I’ve already tried to add the new offset to instanceStart and instanceEnd, but that only shifts the line segments of one cube. Here’s a fiddle of what I’ve tried.

2 Likes