Optimizing your Space
Last updated
Last updated
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 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)
<InsertMeshName>_LOD1
<InsertMeshName>_LOD2
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.
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.
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.
We have previously allowed Crunch Compresssion on textures to reduce the filesize but have found that due to the textures being uncompressed in browser the memory limitations made spaces unstable if Crunch Compression was used.
Therefore, Crunch compression is not supported in Mona spaces. Builders will be notified if any of their assets use crunch compression in the QA process using the Mona SDK.
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).