• Register
Post news RSS DevLog: 3D graphics for mobile devices part 1

Project Trains: Traffic Control DevLog: 3D graphics for mobile devices part 1

Posted by on

It’s been a while since mobile devices were only able to support very simple 2D graphics. Even back then people realized that mobile games will grow to become something big, but who knew that it will be so big and so epic at the same time?

b821ff80 d0c4 4f93 890b 89a8865b


Today’s mobile GPUs are getting closer and closer to the previous generation of consoles in means of performance. It’s that amazing! But convenience of having mobile devices so small is bound to impose some compromises. One of them is the number of draw calls that are reasonable to execute per frame.

This simply means that we have to batch things or we will break the game.

For Train Traffic game we’re using Unity as our game engine. Unity has built-in static and dynamic batching mechanism. Both batching algorithms have the limitation of using the same material in order to do the batching, but since some of our objects are moving (yes, we have moving object in our game ;-) there’s one more limitation of 900 vertex attributes per object. Since we’re defining vertex positions, normals and uvs, we are forced to cut down allowed vertices to 300 per object.

Zrzut ekranu 2015 05 28 18 11 39

Of course the limitation of 300 vertices is something that we couldn’t agree on when creating train models that are bigger than car models, so we decided to sacrifice a little performance over the great look.

Zrzut ekranu 2015 05 28 18 14 48

Through experience we found out that keeping the number of draw calls around 150 is acceptable, 200 is the limit and 250 results in visible performance loss. Knowing that we started to build our levels.

We knew that there will be a year or more before our game will be released. We also knew that our game will be on the market for some time, so we decided to target the middle-top devices. Still what we yearn most is for our players to have fun with game, so some of graphics features can be turned off in the options menu.

Let's take a look at the very first level of our game.

98ac76bd ab44 4bcb bb17 d260bee9

To render this level without any optimizations Unity requires 942 draw calls. But we were able to reduce it to 177 mostly by batching, terrain optimizations and lightmapping.

faa9c779 a995 487e 917e 80c4f1ed

And yes, we have dynamic shadows casted by trains! Yet, we're down to 177!

desktop


In the part 2 I will talk about tricks that we've used to improve visuals without killing the GPU.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

News
Tags
Dev Diary
Browse
News
New
Post news
Share
Related Games
Related Engines
Unity
Unity Commercial
Related Groups