Low framerate when using lots of text nodes in gui

#1

I need to use lots of text nodes in gui (around 70). In such case the frame rate drops substantially. How can I improve the situation? I’m running a debug version on windows.
Here’s what profiler shows:

0 Likes

#2

Profiler shows 301 Draw Call, it seems like your GUI do not optimized.
Please read this topic about the draw calls optimization, it should help you:

5 Likes

#3

It helped. I used templates with text nodes mixed with box nodes which broke batching. I’ve put text nodes to a separate layer and it worked out perfectly.
Here’s what profiler shows now:

3 Likes

#4

Still too many drawcalls, you should try to get it under 100 for mobile.

1 Like

#5

Ok, thanks, I will.

0 Likes

#6

Yes, it should be possible to get lower than 100, probably a lot lower.

Do you know where you draw calls originate from? How many game objects and sprites do you have? How many gui components? Share a screenshot of the table to the right (Counters).

0 Likes

#7

Well, yes, there’s a lot of nodes and many of them are text nodes with different fonts. I’m currently using a separate font for different font sizes (I was trying to get better text look, unfortunately it didn’t help, but I left it for a time being). Here’s the table to the right:

0 Likes

#8

Are you using df/distance field fonts? You can make a custom material with a custom fp to add extra sharpness so that when text is scaled down it doesn’t get as blurry, then it’s more useful to use one font for multiple sizes.

1 Like

#9

I’m using bitmap fonts because df font gets weird color tint when scaled too much. Is there such fp shader already exists? Shaders are my weak spot :pensive:

0 Likes

#10

Example modification is very simple, you only halve the smoothing, or whatever value looks best for your project.

2019-06-13%2007_29_06-JointHookshot 2019-06-13%2007_28_40-JointHookshot

Top has this modification, bottom uses builtin. So you can see the builtin version turns grey when scaled down but reducing the smoothing helps to minimize that.

What do your fonts look like currently?

2 Likes

#11

I’m sure there’s more to be done with layers to reduce draw calls! Can you share a screenshot? In theory and sometimes in practice you can get draw calls down to the number of atlases+number of fonts+possibly one or two more if you want stuff both above and below text.

2 Likes

#12

2019-06-14%2003_02_53-Window

Here’s a slightly different modification, instead of reducing all smoothing only reduce the edge. Again in each screenshot top is modified bottom is builtin.

This stays more consistently colored when scaled and looks a bit smoother.

5 Likes

#13

Thank you guys! Everything you suggested helped a lot. I managed to get it to 15 draw calls.

8 Likes

#14

Cool! I’m happy that to hear that you managed to rework and optimize your GUI!

3 Likes