InstancedMesh - Lines?

Is it possible to use the the ANGLE_instanced_arrays feature with lines via three.js? I suppose there should be something like InstancedLine, but I can’t find such a thing. According to this, it should be possible to do such a thing: https://developer.mozilla.org/en-US/docs/Web/API/ANGLE_instanced_arrays/drawArraysInstancedANGLE

InstancedMesh is derived from Mesh so it can’t be used for points or lines. However, you can use InstancedBufferGeometry for all render primitives. Unfortunately, there is no official example that shows how the generate such a geometry for points and lines but the process is basically similar to rendering triangles. Use this as a code template

https://threejs.org/examples/webgl_buffergeometry_instancing

1 Like

Depending on what you’re trying to do the Lines2 example may be something to look at. It doesn’t use gl lines but it does use mesh instancing to draw the line segments:

https://threejs.org/examples/?q=line#webgl_lines_fat

Thanks guys, will try the links you’ve sent, and I’ll choose the most suitable for my needs. Thanks again!

1 Like