fastest way to draw millions of lines?
hi, i'm trying to create a multi-platform tractography visualization tool, to visualize datasets such as this: http://brainsuite.org/wp-content/uploads/2015/02/tracts2.png
basically, each dataset contains hundreds of thousands of "streamlines" which are just a bunch of connected line segments (typically, 50-100 points per streamline).
i've tried using immediate mode (GL.Lines) but the performance is quite poor, i also downloaded the fastLineRenderer asset and it didn't really improve much on my device, and i hear that vectrosity is much the same.
i was wondering if there is a faster way to draw lines (or any shape for that matter) than GL.Lines immediate mode, in the onPostRender method? based on some other applications i've seen that do the same thing i'm trying to do, i should be getting 5-10x faster than what i'm getting with GL.Lines. i've read that VBOs may help, but i don't know much about them or if its even worth getting into.
thanks
Answer by FortisVenaliter · Sep 29, 2017 at 07:17 PM
You can make Mesh objects with line geometry. I would go that route. When you set the indices, just choose MeshTopology.Lines.
But for an image like the one you linked, you're going to have a very hard time getting that to render in real-time, I think.
Almost certainly, because the mesh would be stored in VRA$$anonymous$$ rather than having to be sent to the GPU each frame.
cool thanks, this really sped up my code (haven't quantified by how much yet, but it looks to be at least 5x faster possibly more (vs GL.Lines), based on how my framerate has improved).
now i'm gonna have to look into customizing the color of each line segment on the mesh, and hiding/displaying different lines on the mesh, according to user interactions.
i'll post some code + detailed comparison in a day or two, thanks again!
Your answer
Follow this Question
Related Questions
Why Line Renderer draw in delay ? 1 Answer
Why drawing GL quads is so slow? 1 Answer
Issue with trail renderer alignment 0 Answers
Unusual Unit Slowdown 0 Answers
URP Doesn't Pass Camera.Current to OnRenderObject? 0 Answers