Sick Gaming
News - Blog: Is mesh-baking your assets really worth it? - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Sick Gaming Community (https://www.sickgaming.net/forum-1.html)
+--- Forum: Lounge (https://www.sickgaming.net/forum-8.html)
+--- Thread: News - Blog: Is mesh-baking your assets really worth it? (/thread-95763.html)



News - Blog: Is mesh-baking your assets really worth it? - xSicKxBot - 06-18-2020

Blog: Is mesh-baking your assets really worth it?

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it.jpg" width="938" height="500" title="" alt="" /></div><div><p>Today, I had the pleasure to interview Ian Deane.</p>
<p>Ian is the developer behind&nbsp;<strong>Mesh Baker</strong>, the famous Unity asset that lets you drastically reduce your draw calls&nbsp;<strong>so your game runs at substantially higher frame-rate</strong>.</p>
<p data-css="tve-u-17265b2fa16">Welcome Ian!</p>
<p data-css="tve-u-17265b6382f">* Disclosure: some affiliate links here and there</p>
<p><img alt data-css="tve-u-1719e10d346" data-height="250" data-id="7602" data-init-height="500" data-init-width="938" data-lazy-sizes="(max-width: 469px) 100vw, 469px" data-lazy-srcset="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it.jpg 938w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-4.jpg 300w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-5.jpg 469w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-6.jpg 768w" data-was-processed="true" data-width="469" height="250" loading="lazy" sizes="(max-width: 469px) 100vw, 469px" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it.jpg" srcset="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it.jpg 938w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-4.jpg 300w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-5.jpg 469w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-6.jpg 768w" title="Thumbnail" width="469"></p>
<p><strong>Quick Navigation</strong> </p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301060" rel="nofollow">1. Could You Tell Me a Bit About Yourself?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301061" rel="nofollow">2. How Did You Get Started in Unity Development?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301062" rel="nofollow">3. What Obstacle Made You Write Mesh Baker?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301063" rel="nofollow">4. For the People Who Don’t Know About Mesh Baker:&nbsp;What Does It Do?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301064" rel="nofollow">5. How Has Mesh Baker Helped Unity Developers Reach Their Performance Goals?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301065" rel="nofollow">6. If You Could Go Back in Time, Is There Something You Would Have Done Differently?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301066" rel="nofollow">7. Besides Mesh Baker, What Are You Currently Working On?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301067" rel="nofollow">8. Anything Else You’d Like to Share With Our Community?</a></p>
<p><a href="https://thegamedev.guru/unity-cpu-performance/mesh-baker-interview-ian-deane/#t-1590842301068" rel="nofollow">9. Lastly, Tell Me Something That’s True, That Almost Nobody Agrees With You On.</a></p>
<h2 dir="ltr" id="t-1590842301060">1. Could You Tell Me a Bit About Yourself?</h2>
<p dir="ltr">I work from a remote small town, self employed, in the games industry.</p>
<p dir="ltr">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.</p>
<p dir="ltr"><strong>The lack of pressure is perhaps&nbsp;</strong><strong>both a curse as a blessing</strong>&nbsp;— pressure would probably keep me more focused — but I spend my time doing what I enjoy.</p>
<p dir="ltr">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.</p>
<h2 dir="ltr" id="t-1590842301061">2. How Did You Get Started in Unity Development?</h2>
<p dir="ltr"><em>Murder at Blaylock Manor</em>, a point-and-click murder mystery created for a university multimedia course, was my first game.</p>
<p dir="ltr">Never heard of it? Not surprised — only six people ever played it — but who cares? It was more fun to create than to play.</p>
<p dir="ltr">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.</p>
<ul>
<li dir="ltr">The iPhone and Android app stores were suddenly a huge untapped market for simple, casual games that could be created by a small team.</li>
<li dir="ltr">Indie hits like Minecraft and Braid showed it was possible to be a successful independent.</li>
</ul>
<p dir="ltr">When Unity added iPhone and Android as targetable platforms, I quit my programming job and decided to work as a self-employed independent.</p>
<h2 dir="ltr" id="t-1590842301062">3. What Obstacle Made You Write Mesh Baker?</h2>
<p dir="ltr">When I put my first mobile game on an Android phone, it ran at&nbsp;4 FPS.</p>
<p data-css="tve-u-17265bc9357" dir="ltr">Ugh!</p>
<p dir="ltr">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…&nbsp;<strong>repeat the whole process</strong>. Add another prop and … repeat.</p>
<p dir="ltr">This process&nbsp;wasted&nbsp;huge amounts of time.</p>
<p dir="ltr">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.&nbsp;</p>
<h2 dir="ltr" id="t-1590842301063">4. For the People Who Don’t Know About Mesh Baker:&nbsp;<br /> What Does It Do?</h2>
<p dir="ltr">There is a very tedious workflow that most developers run into when optimizing a game.</p>
<ul>
<li dir="ltr">Combine textures into a set of atlas textures</li>
<li dir="ltr">Adjust the UVs of all meshes to use the new atlas texture</li>
</ul>
<p dir="ltr">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.&nbsp;</p>
<p dir="ltr"><a href="https://assetstore.unity.com/packages/tools/modeling/mesh-baker-5017?aid=1011l9AKa" target="_blank" rel="noopener noreferrer"><strong>Mesh Baker</strong></a><strong>&nbsp;automates this process</strong>.</p>
<p dir="ltr">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.</p>
<p dir="ltr">Mesh Baker can combine the meshes or create prefabs that use the atlas materials. It works with both MeshRenderer meshes and skinned meshes.&nbsp;</p>
<p> <img alt="Texture Atlas (Mesh Baker)" data-css="tve-u-1727f8e4d17" data-height="459" data-id="7585" data-init-height="800" data-init-width="800" data-lazy-sizes="(max-width: 459px) 100vw, 459px" data-lazy-srcset="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-1.jpg 800w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-7.jpg 300w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-8.jpg 768w" data-tcb-events="__TCB_EVENT_[{&quot;t&quot;:&quot;click&quot;,&quot;a&quot;:&quot;thrive_zoom&quot;,&quot;c&quot;:{&quot;id&quot;:&quot;7585&quot;,&quot;size&quot;:&quot;full&quot;}}]_TNEVE_BCT__" data-was-processed="true" data-width="459" height="459" loading="lazy" sizes="(max-width: 459px) 100vw, 459px" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-1.jpg" srcset="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-1.jpg 800w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-7.jpg 300w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-8.jpg 768w" width="459"></p>
<p>Texture Atlas (Mesh Baker)</p>
<h2 dir="ltr" id="t-1590842301064">5. How Has Mesh Baker Helped Unity Developers Reach Their Performance Goals?</h2>
<p dir="ltr">Mesh Baker is an optimization tool to help developers to speed up their game.&nbsp;</p>
<p dir="ltr">A major performance bottleneck for many games is “too many drawcalls and setpass calls”. These drawcalls/setpass calls are expensive because they&nbsp;<strong>interrupt the GPU</strong>.</p>
<p dir="ltr"><strong>The GPU is like an assembly line</strong>.</p>
<p dir="ltr">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).</p>
<p dir="ltr">If the GPU does not need to be&nbsp;<strong>re-configured</strong>&nbsp;(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.</p>
<p dir="ltr">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.</p>
<p dir="ltr">Recently Mesh Baker has added the capability to create&nbsp;<em>Texture Arrays</em>, which are like an atlas with fewer limitations. Without a tool like Mesh Baker, Texture Arrays are difficult to create and work with.</p>
<p dir="ltr">Mesh Baker also works with&nbsp;<em>Skinned Meshes</em>. 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.&nbsp;</p>
<h2 dir="ltr" id="t-1590842301065">6. If You Could Go Back in Time, Is There Something You Would Have Done Differently?</h2>
<p dir="ltr">Mesh Baker has had two major rewrites and (with the emergence of DOTs/ECS) is about to be re-rewritten again.</p>
<p dir="ltr">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.</p>
<p dir="ltr">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.</p>
<p dir="ltr"><a href="https://assetstore.unity.com/packages/tools/modeling/mesh-baker-5017?aid=1011l9AKa" target="_blank" rel="noopener noreferrer">Mesh Baker</a>&nbsp;is very much in continuous development.</p>
<p dir="ltr">The next major rewrite will be to take advantage of Unity’s&nbsp;<strong>DOTS/ECS</strong>&nbsp;high performance framework.</p>
<p> <img alt="Shadow of the Colossus (Source: pushsquare.com)" data-height="450" data-id="7590" data-init-height="450" data-init-width="800" data-lazy-sizes="(max-width: 800px) 100vw, 800px" data-lazy-srcset="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-2.jpg 800w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-9.jpg 300w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-10.jpg 768w" data-was-processed="true" data-width="800" height="338" loading="lazy" sizes="(max-width: 800px) 100vw, 800px" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-2.jpg" srcset="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-2.jpg 800w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-9.jpg 300w, https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-10.jpg 768w" width="600"></p>
<p>Shadow of the Colossus (Source: pushsquare.com)</p>
<h2 dir="ltr" id="t-1590842301066">7. Besides Mesh Baker, What Are You Currently Working On?</h2>
<p dir="ltr">My all time favorite game is&nbsp;<em>Shadow Of The Colossus</em>.</p>
<p dir="ltr">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.</p>
<p dir="ltr">The forces and torques are calculated by a ML model trained using&nbsp;<strong>Unity’s ML Agents</strong>.&nbsp;</p>
<p dir="ltr">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.&nbsp;</p>
<p dir="ltr">My dream is to make a game that would be a cross between&nbsp;<em>Shadow Of The Colossus</em>&nbsp;and&nbsp;<em>Goat Simulator</em>.</p>
<p> <img alt="Neural Networks &amp; Animation" data-height="360" data-id="7606" data-init-height="360" data-init-width="640" data-was-processed="true" data-width="640" height="338" loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it.gif" title="NeuralNetDrivesRagdoll" width="600"></p>
<p>Neural Networks &amp; Animation</p>
<h2 dir="ltr" id="t-1590842301067">8. Anything Else You’d Like to Share With Our Community?</h2>
<p dir="ltr">What a time to be a game developer!</p>
<p dir="ltr">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.</p>
<p dir="ltr">Today, Unity and Unreal are free.</p>
<p dir="ltr">There is an&nbsp;<strong>exponential explosion of excellent content&nbsp;</strong><strong>creation tools</strong>. 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.&nbsp;</p>
<h2 dir="ltr" id="t-1590842301068">9. Lastly, Tell Me Something That’s True, That Almost Nobody Agrees With You On.</h2>
<p dir="ltr">I believe that deep learning research is on the cusp of creating a new form of life.</p>
<p dir="ltr">The intelligent “others” we are seeking in the stars will not be found there, they will be found in our AI research labs.</p>
<p dir="ltr">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.</p>
<p> <img alt="Physically Simulated Animations (Ian Deane)" data-height="480" data-id="7586" data-init-height="480" data-init-width="640" data-tcb-events="__TCB_EVENT_[{&quot;t&quot;:&quot;click&quot;,&quot;a&quot;:&quot;thrive_zoom&quot;,&quot;c&quot;:{&quot;id&quot;:&quot;7586&quot;,&quot;size&quot;:&quot;full&quot;}}]_TNEVE_BCT__" data-was-processed="true" data-width="640" height="450" loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/06/blog-is-mesh-baking-your-assets-really-worth-it-1.gif" title="ian-deane-unity-ml-ragdolls" width="600"></p>
<p>Physically Simulated Animations (Ian Deane)</p>
<hr>
<p dir="ltr">Thanks for your time, Ian. I’m sure we’ll be collaborating again sometime soon.</p>
<p dir="ltr">Here is the complete list of assets he crafted. Give them a look, they might surprise you.</p>
<p>Are they a good fit for your project?</p>
<p>~Ruben</p>
</div>


https://www.sickgaming.net/blog/2020/06/16/blog-is-mesh-baking-your-assets-really-worth-it/