A quick optimization test: Investigating Draw Calls.

So lets discuss our draw call issue.

Draw Calls are called when Unity needs to paint a texture onto a mesh. The issue that we were having was that each piece of each character was separated, so we were getting over 150 draw calls for each character.

Through a simple test, we were able to find out a few things.

Image

We took a single cube in Maya, and imported it into Unity, and placed it in an empty scene. Unity, by default, uses 1 Draw Call to paint the background, and then THREE (not 1) for each mesh that has a texture.

Image

Then, we took that same cube and duplicated it in Maya, created two separate meshes. We then reimported it into Unity and the blank scene. This resulted in 7 draw calls: 1 for the background, and 3 for each cube; this was the expected result, so no surprises here.

Image

Then, we wanted to see if a simple Maya “Mesh -> Combine” would be enough to make Maya things play nice while reducing draw calls. After combining the two cubes in Maya and reimporting, the draw calls went back down to 4. Therefore, we were able to conclude that combining our character meshes will reduce draw calls and fix a lot of our performance issues.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: