SetPass calls - important to keep this number low?

Hey,

Could somebody please tell me a little about SetPass calls and whether or not it’s important to keep this number low? I’m batching a lot of my images/sprites to save draw calls and keep the game running smoothly. The setpass calls though, what are they?

The number is typically below 60 at the most, I’ve attached a picture of the game in editor, in case this may prove helpful.

Would really appreciate some wisdom on this, Thanks in advance.

@RickyWild it’s been a while, but I disagree on @tanoshimi view of the subject.

If SetPass calls didn’t matter then no one would bother creating a texture Atlas. Depending on your target platform SetPass Calls, and Vert counts are the two most important things to get the game running smoothly. I’d have to say >300 SetPass Calls, with millions of tris, is simply bad optimization in general.

Giving an exact number of what you should be at for specific platforms is difficult, and depends on many other factors in your game like are you using Physics? Rigidbodies? How many colliders? etc. But just keep those numbers in mind throughout development, and if there’s a way to have less without sacrificing game play then do it.

If you are targeting high-end PC platform, and enjoy melting your GPU/CPU during development then go hog wild. If you are targeting mobile keep them low, and WebGL even lower. To give you an idea, one of my mobile games has ~20k tris at even given time, and ~15 SetPass calls. On an iPhone 6 it runs beautifully, on an iPhone 4 it has 20-30 FPS.

The accepted answer is incorrect. To answer it simply, YES, SetPass calls should be as low as possible. In the most simple terms you need to keep you communication between the GPU and CPU less frequent, because it’s slow as compared to intra communication within the CPU itself. There are two main factors that cause frequent communication between the GPU and the CPU.

  1. Draw Calls: To keep it short, a lot of meshes that use different materials, all cannot be sent to the GPU in a single call to be rendered. Thus they cause a lot of draw calls. To keep this number low you can combine meshes into one and make sure that a single material can be shared amongst many different meshes/renderers. Sub meshes also can break DrawCalls so they also need to be merged.

  2. SetPass Calls: Draw call sets up a mesh and submits it for rendering, whereas a SetPass call is when all the data from a material for rendering a mesh is setup. When a material is not changing it is often possible to skip SetPass calls. Each time a material is changed, it results in a new SetPass call. So to lower this number you need to somehow combine materials as much as possible

Thus, If you have a complex scene containing high polygon 3d models with a lot meshes that use a lot of different materials, the overall performance of your game will suffer. You can check out my tool on the unity asset store “Poly Few” that aims to solve this problem by allowing you to optimize high quality complex 3d scenes. With integrated features like mesh simplification, automatic LOD generation, mesh merging and material combining, you can greatly improve the performance of your game by lowering the Polygon Count, DrawCalls and SetPass calls with a few clicks and, without the need of writing even a single line of code.

I Agree with @Time_Flys
SetPass calls is very important especially when dealing with Mobile.
neglecting this will surely contribute heating of the phone.

@tanoshimi What did you think to say these words?, If you didn’t know, don’t say anything. That maybe a bad affect to another people. Your answer definitely does not make any sense.

Frame rate is literally never king. It’s pretty easy to have a ‘high frame rate’ with big stutters. A labour voter with completely the wrong idea about everything is pretty standard.

You need to define your own budgets for things like draw calls based on the hardware you are targeting. This is explained well by unity themselves - Best practices for profiling game performance | Unity

Tanoshimis accepted answer is the worst one in this thread

Is it important? No, not really. People used to obsess about keeping drawcalls below a certain limit, but ultimately your users and never going to know or care, and the number of draw calls required to severely impact performance depends heavily on the hardware in question, so it’s very hard to give any advice on acceptable limits anyway.
Frame rate is king. Concentrate on monitoring and maintaining that, and don’t worry about anything else.