June 08 2020
By Rubén Torres Bonet
June 08, 2020
Today, I had the pleasure to interview Ian Deane.
Ian is the developer behind Mesh Baker, the famous Unity asset that lets you drastically reduce your draw calls so your game runs at substantially higher frame-rate.
* Disclosure: some affiliate links here and there
I work from a remote small town, self employed, in the games industry.
I support myself mostly as an Asset Store publisher and consultant, so although my games have not been financially successful yet, I have enough income and spare time that I can work on whatever interests me without worrying about immediate commercial success or meeting a specific release date.
The lack of pressure is perhaps both a curse as a blessing — pressure would probably keep me more focused — but I spend my time doing what I enjoy.
These days, most of my time is spent teaching powered ragdolls to walk using machine learning and trying to use them to drive a Character Controller.
Murder at Blaylock Manor, a point-and-click murder mystery created for a university multimedia course, was my first game.
Never heard of it? Not surprised — only six people ever played it — but who cares? It was more fun to create than to play.
Since then, I have been tinkering with every game-engine-like tool I could get my hands on (Director, Flash, Torque).I fell in love with Unity3D when version 2 came out. The games industry was shifting rapidly.
When Unity added iPhone and Android as targetable platforms, I quit my programming job and decided to work as a self-employed independent.
When I put my first mobile game on an Android phone, it ran at 4 FPS.
The biggest problem was having too many drawcalls. Reducing drawcalls required combining meshes, and for that, meshes needed to share materials and textures. I spent many tedious hours combining textures into a single large atlas-texture, adjusting the UVs of each mesh, writing scripts to combine them. Then I added a new prop with another material and… repeat the whole process. Add another prop and … repeat.
This process wasted huge amounts of time.
I needed a tool that could automate this workflow, take a list of meshes, create atlases for the textures, adjust the mesh-UVs and combine the meshes. Ideally this could be done per-scene, so that if a prop was added or removed, the whole workflow could be re-done at the click of a button.
There is a very tedious workflow that most developers run into when optimizing a game.
This job can consume many, many hours and the work needs to be discarded and repeated if textures are added or removed. It is also a destructive process since meshes are being modified.
Mesh Baker automates this process.
A developer can supply a set of meshes, and Mesh Baker will create atlases from the textures used by the materials, and adjust the UVs of the meshes.
Mesh Baker can combine the meshes or create prefabs that use the atlas materials. It works with both MeshRenderer meshes and skinned meshes.
Mesh Baker is an optimization tool to help developers to speed up their game.
A major performance bottleneck for many games is “too many drawcalls and setpass calls”. These drawcalls/setpass calls are expensive because they interrupt the GPU.
The GPU is like an assembly line.
Meshes are fed in as input. Rendered 2D images are the output. A drawcall/setpass call interrupts this assembly line, since the cores must sit idle, waiting for the GPU to be re-configured (like a factory being re-tooled to produce a different product).
If the GPU does not need to be re-configured (all meshes share a material) then it can run at full capacity for the entire frame. Mesh Baker helps developers modify meshes so that more meshes share materials.
Unity’s performance improvement systems (static and dynamic batching) become far more effective in scenes where most or all meshes share a material. Meshes that share materials can also be easily combined to reduce drawcalls further.
Recently Mesh Baker has added the capability to create Texture Arrays, which are like an atlas with fewer limitations. Without a tool like Mesh Baker, Texture Arrays are difficult to create and work with.
Mesh Baker also works with Skinned Meshes. Characters can be customized (different clothing) without creating extra drawcalls. Also many low-poly MeshRenderers (eg. shards of a shattering object) can be converted from many-MeshRenderers to a single skinned-mesh so that it only has one draw call.
Mesh Baker has had two major rewrites and (with the emergence of DOTs/ECS) is about to be re-rewritten again.
The first rewrite fixed an issue where Texture Baking and Mesh Baking were tightly coupled. The rewrite made texture atlases much more flexible and re-usable project-wide instead of being tied to a scene and a single set of source meshes.
The second rewrite changed how Texture Atlases were generated. Mesh Baker now supports multiple Texture Packers designed to handle runtime baking, texture array generation, atlases containing edge-to-edge tiling textures and general texture baking.
Mesh Baker is very much in continuous development.
The next major rewrite will be to take advantage of Unity’s DOTS/ECS high performance framework.
My all time favorite game is Shadow Of The Colossus.
What I love the most is the physically realistic character movement. Currently I am working on a powered ragdoll character controller that walks, jumps and moves by applying forces and torques to its joints — just like a person in the real world. The character needs to keep its balance and propel itself by pushing on the ground with its feet. It can fall over, and needs to get up if it falls down.
The forces and torques are calculated by a ML model trained using Unity’s ML Agents.
The latest iteration (training in the background as I type this) uses a camera to generate a heightfield of the terrain that the character is walking over. The model is learning to walk on uneven surfaces and step over small obstacles and gaps.
My dream is to make a game that would be a cross between Shadow Of The Colossus and Goat Simulator.
What a time to be a game developer!
When I started working in the industry, licensing a high quality game engine cost hundreds of thousands of dollars. Good tools were scarce, learning resources were limited.
Today, Unity and Unreal are free.
There is an exponential explosion of excellent content creation tools. Hardware is more powerful than it has ever been, and deep learning is about to unlock whole new genres of games, AI (Artificial Intelligence), and content generation tools.
I believe that deep learning research is on the cusp of creating a new form of life.
The intelligent “others” we are seeking in the stars will not be found there, they will be found in our AI research labs.
After four billion years of evolution based on DNA and biology, an entirely new form of life is emerging based on silicon eating electricity. This new form of life will exceed the intellectual capabilities of humans and in a handful of generations, the AIs (Artificial Intelligence) will be designing themselves. There is nothing artificial or unnatural about this new form of life, it is the latest twist of evolution.
~Ruben: It is very inspiring to me to see this less-known side of Ian. I was amazed to uncover what made him take this journey towards game optimization and asset store publishing.
Combining your materials is truly worth if you are developing a production game. You’ll get to spend more time on the gameplay systems that matter, instead of wasting it in rendering when you could avoid it.
Here is the complete list of assets he crafted. Give them a look, they might surprise you.
Are they a good fit for your project?