PolyLine mesh generation performance with many points

Avatar
  • updated
  • Answered

Hi!

First off, I really like this plugin and I'm happy with nearly everthing I've seen so far.

Where I'm running into an issue currently, is updating PolyLine components with a large number of points.
The mesh generation is quite CPU intensive and allocates a lot of garbage. I undertstand this is not exactly the intended use case, but I would really like to take advantage of the nice anti-aliasing feature.

What is the optimal method for updating the points?

Is there something I'm missing?

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
URP
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Answered

currently there is no optimal way to update the points, as it will regenerate the entire mesh regardless, so with a huge number of points it will get expensive no matter what.

one thing you can do right now to save performance (and rendering) is to use either simple or miter joins, as they don't generate the extra join meshes, unlike rounded and bevel joins which are more expensive.

but yeah the point update issue is very much old behavior that I just haven't found the time to fix yet! the polyline code has a lot of issues I'm looking to fix in a future update, with that coming update I want to make it so that it doesn't allocate, and so that it doesn't regenerate the entire mesh on every modification, as well as add things like dash support and whatnot

Avatar
Freya Holmér creator
  • Answer
  • Answered

currently there is no optimal way to update the points, as it will regenerate the entire mesh regardless, so with a huge number of points it will get expensive no matter what.

one thing you can do right now to save performance (and rendering) is to use either simple or miter joins, as they don't generate the extra join meshes, unlike rounded and bevel joins which are more expensive.

but yeah the point update issue is very much old behavior that I just haven't found the time to fix yet! the polyline code has a lot of issues I'm looking to fix in a future update, with that coming update I want to make it so that it doesn't allocate, and so that it doesn't regenerate the entire mesh on every modification, as well as add things like dash support and whatnot

Avatar
Tom Mertz
Quote from Freya Holmér

currently there is no optimal way to update the points, as it will regenerate the entire mesh regardless, so with a huge number of points it will get expensive no matter what.

one thing you can do right now to save performance (and rendering) is to use either simple or miter joins, as they don't generate the extra join meshes, unlike rounded and bevel joins which are more expensive.

but yeah the point update issue is very much old behavior that I just haven't found the time to fix yet! the polyline code has a lot of issues I'm looking to fix in a future update, with that coming update I want to make it so that it doesn't allocate, and so that it doesn't regenerate the entire mesh on every modification, as well as add things like dash support and whatnot

Looking forward to this! Love the library, but we're doing some pretty complex line visualizations (which look amazing) that are nomming on the CPU currently.