Equivalent to setDrawRange with InstancedBufferGeometry


I am trying to display a trajectory from lines that are story in an instancedBufferGeometry.
To be able to dynamically choose the length of the trajectory, I need to use something similar to setDrawRange.

Though I saw that only instanceCount works with instancedBufferGeometry and it costs too much processing to keep put the new line at the beginning of the buffer.

Is there a way to replicate setDrawRange with an instancedBufferGeometry?

In this example, I hide things on demand. Maybe this helps?


It is part of a larger project that is still incomplete.

Link to the development CPU-Simulation-8Bit

Thanks for the reply.

Though I don’t think your use case can solve my problem.
I am using instancedBufferAttributes and instancedBufferGeometry that you don’t use.

instanceCount is indeed the equivalent to drawRange and there is no other alternative.

Do you mind explaining why are using instanced rendering for line primitives? Or are you working with the fat line implementation?

InstanceCount is limiting because, unlike drawRange, we cannot set the start index…

Yes I am using the fat lines implementation!

1 Like