Should I use lines with thin instances?

In my project I need to debug insane amount of rays.
I tried to write code that creates thin instance for line by two points.
But I think that line is an simple mesh, so maybe thin instancing is not a best practice here.
Individual colors are required.
@Evgeni_Popov, I will be happy to hear your opinion.
Here is code Babylon.js Playground

If you make a thin instance for each line it’s probably better to use a LineSystem instead where you create all your lines and don’t use thin instances, as each thin instance will consume 64 bytes for each world matrix, whereas a line only consumes 24 bytes (2 points, 3 floats per point). A LineSystem is also drawn as a single draw call.

[…] Correction, the LineSystem also needs indices, so it’s an additional 4 or 8 bytes per line, depending on the total number of indices (less or more than 65535).

1 Like