Sourcing for Circularity

The linear economy is, simply put, a one-way ticket from ‘take’ to ‘waste’. We extract a material, we make something from it, we sell it, use it, discard it. The circular economy, by contrast, is a…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Real Time GI vs Baked for Mobile Games

Diary of an Indie Game Developer: Chapter 42

As you probably know by now, I’m working on a mobile game which means, compared to PC or console, I’m on a really tight budget when it comes to… well… EVERYTHING. Texture sizes. Mesh sizes. Particle system complexity. You name it. Everything is expensive.

That said, from day one I knew I was going to want my game to have global illumination, and unless I just couldn’t make it work at all on mobile, I was willing to spend some of my precious resource budget to get it. So, I’ve spent a LOT of time trying various approaches to GI to see what works and what doesn’t on mobile.

As you can see in the video above, the lighting is awesome, and because it’s a real time GI solution, the lighting can be changed on the fly at run time without breaking the GI.

Unity’s second builtin system for GI is a traditional baked solution provided by their Progressive Lightmapper. I talked about the Progressive Lightmapper in a previous post, and like Enlighten, it too produces beautiful lighting. What’s more, Unity is working on a version of their Progressive Lightmapper that runs on the GPU allowing you to to bake lighting ~10x faster:

So, which GI solution should I use for my game? Real time or baked? Fortunately, in my testing, both options can work well on mobile. That said, there are pros and cons to each approach.

First, let’s take a look at the cons.

Baked GI, on the other hand, has no run time CPU cost, but all of those baked lightmaps can add up quickly. On one of my early test levels, baking GI produced 120 MB worth of lightmaps. That’s no big deal on a PC or console game, but on mobile, 120 MB worth of lightmap textures is a LOT. Another con is that it can take a loooooooooong time to bake lightmaps. Unity’s GPU lightmapper will solve this problem eventually, but it’s only in beta now, so using it in production isn’t really an option at the moment.

So what about the pros?

Baked GI, on the other hand, has no run time CPU cost. It also produces beautiful detailed occlusion.

Given all of those pros and cons, I chose to go with real time GI… at first. Why? My game tends to be GPU bound rather than CPU bound, so I figured I could afford to spend some CPU cycles on real time GI. Also, my texture budget is really tight, and I didn’t relish spending any of it on many mega bytes worth of lightmaps.

But I ran into a problem:

The screenshot above shows a simple test scene with real time GI enabled. As you can see, it looks exactly the same on both the iPhone XS and on the Mac, but there’s a weird greenish tint on the iPhone 6s. I contacted Unity about it and filed a bug report. They seem to think it’s a driver related bug.

If the bug gets fixed in time, I may switch back to real time GI before I ship my game, but since my game needs to run well on the iPhone 6s, I’ve decided to go with baked GI, for now.

See you next week…

Add a comment

Related posts:

5 amazing Apple tv series you CAN NOT miss anymore.

When I first started using Apple TV I thought I wasn’t going to be hooked by it, however, after watching one series of their catalog I started promoting the app to every single friend of mine, and…

Revive the love for your current Phone through Mindfulness

In this cutthroat competitive age of technology and development where each year the big tech companies are launching their new and great devices, followed by their new and great prices , the phone…

Who You Are Is How You Lead

Leaders of organizations disproportionately impact culture and the employee experience. Yet leaders don’t spend enough time on getting to know who they are. My intention is not to argue against the…