Save 50% Memory From 3D Meshes in Unity

by Hell Tap in Unity3D Optimization Techniques, Unity3D Tutorials on December 23, 2012

So this is a pretty awesome optimisation I discovered while I was working on Flight Unlimited Las Vegas.

mzl.slfdyteq.320x480-75

The Problem

The game has a massive part of the Las Vegas area satellite-imaged as part of the flying area. In fact, it is over 130 square miles! This really causes problems on mobile devices as RAM is limited.

I did the usual things when trying to optimise memory usage. Reduced texture sizes for smaller objects, turned off mip-maps (more on that in a different post!), etc. Then I checked out the Profiler to discover something pretty interesting ..

The actual 3D meshes ( NOT the textures ) were taking up the vast majority of the RAM. I found this pretty shocking at first as most of the buildings in the game were pretty low poly. I guess the sheer amount of them stretching over 130 virtual square miles was enough! The meshes alone were taking around 40MB of RAM.

The Solution

After thinking about what might be causing this, I did something insanely effective that I’m sure many of us would skip or not think twice about.. Disable the NORMALS and TANGENTS from the Mesh.

NormalsAndTangents

This has certain side-effects, but luckily, none of them applied to our project.

Normals are a type of data stored in the mesh to help out real-time lights, and Tangents are used to help Shaders perform things like “bump-mapping”.

As the scene was already baked with BEAST light-mapping, the scene wasn’t going to need the normals. And the shaders we used for the environment weren’t using bump mapping so the tangents weren’t a problem either.

The result …?

Mesh Memory was brought down from 40MB to about 23MB. Almost a 50% reduction. This was the difference between iPod4 / iPad1 compatibility, which we were able to offer upon discovering this optimisation.

I’m sure some of you should find this helpful! =)

All the best,

– Mel.

10% Off Your first order!

Add this code at checkout to get a 10% discount on your first order!
10PERCENT

Cart (0)

  • Your cart is empty.