May 13 2022
In this post, you will discover the performance challenges of crowd rendering. Better yet, you’ll learn how to render thousands of character in Unity within your (super tight) performance budget. Yeah, we like it tight around here ;-D
I have no idea about the project you’re working on at the moment. But I’m sure you’ll eventually need to render hundreds or even thousands of real-time characters at some point in Unity. And if you skip reading this post now, you’ll regret it when you fullfil my dark prophecy.
Question: have you played sport games? I’m no big fan of those, but some of my consulting clients are.
Guess what? Those sportful games are infected with crowds. That means, your player REALLY wants to see thousands of observers shouting, fighting, throwing beer at you after puking it, and so on. It adds to the atmosphere after all.
And it’s not just sport games!
Also fighting games, social games, everything games. There’s always a potential need to render thousands of characters in most projects. And if you happen to be the developer behind your bosses’ wishes, well, you better learn how to achieve this - fast -.
So how do you render crowds in your Unity project… like in real-time?
If you just instantiated your characters thousand times, you’d see your frame-rate s(t)ink to 0 FPS faster than you’d see your bank account plummet to zero if your boss fired you because you weren’t able to fix this.
Here’s why Unity’s way will NOT work for you:
Simply put, the performance of Unity doesn’t scale as you increase your number of animators AND skinning operations you do. Like at all.
In fact, not many engines do scale well with this amount of computational work.
As a quick reminder of these l33t terms:
To give you a baseline: my consulting clients suffer from a minimum cost of 3 milliseconds per frame with just a couple of characters. Imagine with dozens, hundreds or even thousands of them, heh.
It’s clear Unity’s way won’t cut it. So let me walk you through the solutions I normally go for.
I’m not going to lie to you: it ain’t easy. Nor sexy. But if you truly want this, you’ll have it.
Here are your main two options:
Independently of the route you choose, here are some addons that will help you reduce the cost of crowd rendering:
Going beyond 4 characters will start degrading your performance significantly. Try the easier things first and see how far you go, though!
If you are serious about rendering hundreds of characters in Unity, check out module 2021.07 when you join www.PerformanceTaskforce.com.
(I won’t lie: you still have to put in the hard work. But knowing the tricks I show you will months of research that I already put in when helping desperated consulting clients)
Good luck!
Ruben Torres Bonet