Multiple polylines in single call

Avatar
  • updated

Hi,

Is it possible to create large array of polylines and draw them in single batch / geometry?
Currently I´m generating lot of Line components & objects and there is quite much overhead there. I also tested Immediate Mode and drawing them using commands but that actually ended up being slower. What is the preferred way? The lines don't change once generated.

Anyhow nice asset!

Cheers,

- Juhani

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
URP
Avatar
Juhani Karlsson

Hi,
This is kinda related: https://shapes.userecho.com/en/communities/1/topics/149-add-a-new-multipolyline-component-shape

Any updates on this or should I try the hack? : )

Cheers,

-J

Avatar
Freya Holmér

no updates on this yet! I do have plans that will help make line rendering faster in the future, but, that is another step separate from this, so this might take a while unfortunately

Avatar
Juhani Karlsson

Hi Freya,

I was able to use your Shapes.ShapesMeshGen.GenPolylineMesh() to generate the mesh and then combine them with Mesh.Combine().
Naturally nothing is visible because the thickness comes from the shader I believe.
So I made custom node that has the Polyline2D features.

I think I have still something wrong with the tangents or something but it is possible to do if one is willing to hack away. On my shitty Surface Laptop 2 the FPS went from 25 to 90 : )) [edit] also it won't really fall under that easily even with more geometry - I tested to up to 500k.

Thanks 'n' cheers,

-J