static builder for Draw.Text(performance issue) or others polygon

Avatar
  • updated
  • Completed

hi,

I bought the Shapes, and I figure out Draw.Text has a performance issue (draw many times with same font setting)

I write the TextMeshProBuilder.

Builder.Begin();

Builder.Append(text)

Builder.End();

Builder.DrawBatch(); // put this at late update or add to urp render pipeline

maybe u can add it to ur urp pipeline of shapes.

and I hope that u can add static builder for your shapes.

let user update the static builder when he needs.

Reporting a bug? please specify Unity version:
2020.3.3f1
Reporting a bug? please specify Shapes version:
3.2.3
Reporting a bug? please specify Render Pipeline:
URP
Avatar
Freya Holmér creator
  • Completed

I've now optimized text rendering a lot for Shapes 4.2.0!

It's not done exactly the same as you describe in your initial post, but

Four things have changed:

1. per-frame allocations is now 0, and CPU processing is now ~10 times faster

2. you can speed it up even more with new persistent text helpers, making CPU end ~140 times faster

3. you can now draw text regions/rects

4. all TMP text alignment options are now available

Avatar
mike johnston

I just did some profiling and was surprised to see this high cost of text. Any improvement here would be appreciated!

Avatar
Freya Holmér creator
  • Under Consideration

yeah, the TMP drawing is currently very bloated. I'll likely do another pass over its functionality at some point, similar to how I also need to do the same for polylines!