Text Mesh Pro Draw calls

Hello, i’m new in the Text Mesh Pro world, so this may appear as a stupid question.

I was wondering if different fonts can be ‘packed’ into one, so we can have only one draw call (just like we can do with sprites).

I’m asking it beacuse draw calls in mobile development are a critical value to anaylze.

Thank you in advance

1 Like

How about you use it and find out?

Also: draw calls aren’t the demon you’re thinking they are :slight_smile: saving 10 is utterly pointless but saving 1000 is a big deal.

I tried, otherwise i wouldn’t have asked here :stuck_out_tongue:

By the way, in my case draw calls are THE demon, since i need my game to run at 60fps; i mustn’t have more than 10 draw calls in order to do it.

Isn’t there a trick to do it?

Sorry for bad english :stuck_out_tongue:

Nonsense.

If 10 draw calls is the margin you have far bigger problems and it won’t ever be consistent even on the same phone type across different people. Some people may have texts or whatever. 10 draw calls is a bad joke.

I assume you’re deploying to mobile.

As @hippocoder stated, draw calls used to be a major thing back in the days of iPhone 3 or thereabouts.

In today’s market and on most devices, there is no real discernible performance difference between 1 or a dozen draw calls.

As such the added complexity of trying to combine these glyph into a single atlas where we might run into issues trying to fit all the glyphs into a single texture or having to use a larger texture which might not be possible due to limitations on texture size on mobile devices or the added performance impact of using a larger texture which could completely negate the performance gains which would already be negligible.

Soi just like @hippocoder said, unless you are looking at a reduction of over 100 draw calls, it isn’t really worth the trouble.

My target is iOS/Android devices, since I have ten fonts, and two sprite atlases i have 12 draw calls, but i noticed that on a 1080p screen it goes from 47 to 55 fps (HTC One M8s), i wanted to have my game as smooth as possible on every device, and reducing draw calls seemed to help a lot (i used to have 20 draw calls and the game was so laggy at 20/30 fps)

If you can provide me help in that way, i’ll appreciate it a lot :smile:

P.S. I wouldn’t ask it if it wouldn’t have performance impacts

It doesn’t have impact. It’s not the draw call causing it, it’s the shader / fill rate.
Everything you think you know is likely wrong / out of date info…

Can you tell us what shaders you are using and are you using profiling?

I’m using:

Sprites-Default shader for sprites,

TextMeshPro/Mobile/DistanceField for texts.

I arrived to the conclusion of draw calls affecting fps by doing a lot of experiments, but if you can tell me a way that can increase my game’ speed using at the same time texts would be brilliant ;D

This is my profiler:

Thank you

P.S. Scripts are optimited, there is only one of them that needs to run plenty of code but im gonna fix it soon

Are these text objects static or are they getting updated every single frame?

Also please set the Profiler to Deep Profile and expand the Camera.Render.Culling.Camera.FireOnPreCull()… until you can see the TextMeshPro.OnPreRenderObject() and provide an image of what is shown there.

Ok, here is it:

In my scene i’ve got 5 different TMPro objects with 5 different fonts, all the rest is composed by 3 sprite atlases

P.S. I’m not using ‘static’ flag on these objects

By static I meant whether or not the text objects are being changed each frame.

Can you please show an Expanded TextMeshPro.GenerateTextMesh()?

Sorry for late, I was busy with Christmas holidays :stuck_out_tongue:

BTW, here is an expanded TMPro.GenerateTextMesh() :

3336294--260310--new.png

And no, i dont update texts every frame (except the FPS meter … )
Thank you

EDIT: Ok, it was the FPS meter! Thank you all!

So, going back to the previous question, are you sure that we can’t combine TextMeshes into a single draw call? (Having multiple ones implies lot of context switch)

1 Like