Optimizing your Space
As Mona uses WebGL to create Spaces it is important to make sure that you optimize your space to run as well as possible in order to have the best experience. There are several ways to improve your Space and the assets within them, and this page will go over some of the methods to do so.
Level of Detail Video Tutorial
Level of Detail is a technique that allows an asset to reduce its polycount at a distance, therefore reducing the amount of polygons the Space needs to render. This improves the performance of a space, especially when those assets are high polygon when close to the avatar.
If you name your assets correctly, Unity will import your assets with the LOD component already applied. This is probably the easiest way to create LODs for assets.
- <InsertMeshName>_LOD0 (The most detailed mesh)
- and so on up to a maximum of 8 LODs...
Otherwise you can assign the LOD Group component and assign them manually. This component has a few options on how the LOD behaves for the object. For more infoamrtion you can check out the unity documentation here.
Optimising Drawcalls Video Tutorial
Drawcalls are the thing that takes a large part of the processing in a Space. Reducing these is very important in creating an environment that runs well on as many devices as possible. There are several ways to reduce the drawcalls of a Space such as the following :
- Reducing the number of Materials (Each material is a drawcall)
- GPU Instancing on Materials (Don't use on small assets however)
- Static Batching by using the 'Batching Static' item in the static menu (set if you apply static)
- Combining Assets in the original 3D Creation tool
It is possible to monitor the drawcalls as well using the Profiler or the Frame Debugger (both found in the Window Menu). These may require a Camera in teh scene, make sure to delete the camera before submitting to QA.
Texture Compression Video Tutorial
It is easy to change the size of a texture (once selected) in the Unity Inspector and see the results of that change directly. Doing this can get a significant filesize reduction of the playable files, and then following those changes up to the original texture would also improve the size of the Mintable Files as well.
Changing the texture size within Unity
Another tool that you can use is Crunch compression. This check box and slider has a great result on reducing a filesize of the texture with very little affect on the texture itself, that said, the texture will be it's full size when being used in the space so the memory will be used at it's original size, this is mostly a filesize improvement.
Note that building your playground, and opening your space will also take more time.
Using Crunch Compression (5.3Mb > 1.3Mb)
Do note the Bakery seems to crash in certain situations using Crunch Compression, Emissive materials seems to be the main issue. So keep that in mind before using Crunch compression with Bakery.
Occlusion Culling Video Tutorial
As a game engine does not automatically know what it should or should not render to the screen it is up to the builder to help decide what elements should be hidden when behind other objects. This can improve the performance of a Space as there is less to render overall.
Setting an asset to be an Occluder (an object that 'hides' other objects) or an Occludee (an asset that is hidden) can be easily done using the pull down menu next to the Static check box at the top right of the Inspector. If you set an object to static, they will be both an Occluder and Occludee by default, but you can customize these settings as you need.
To apply these occlusion settings though, you will need to bake the occlusion information into the assets using the Occlusion Baking tools found under Window > Rendering > Occlusion Culling and using the Bake tab to bake the information at the bottom right.
It is also possible to add Occlusion Areas in order to have more control over which areas should have more accurate Occlusion (such as main rooms etc.), this will save time on occlusion baking as well as reduce the overall filesize (depending on how complex your environment is of course). An Occlusion Area is a component you can add to an asset, usually an empty gameobject that allows you a clean asset to modify as needed.
Another tool is the Occlusion Portals Component. This allows you to create a Occlusion Culling object without the need for an asset itself (such as a 3D object).