WebGL Overview
A general overview of things to consider when creating a Space.
Before moving on we need to look at some of the differences between building for standard games, and building for web based experiences like Mona.
As Spaces run in WebGL on a browser it is very important to optimise your assets in your space so that it can run well. A basic understanding of creating optimized game ready assets is important to make sure you create a space that can run on most if not all devices.
A few things that you need to consider include :
- Polycount - Keep the polycount of your assets as low as possible
- Materials - Keeping the number of Materials as low as possible
- Textures - Utilising textures in ways to have as small, and few textures as possible
If Mobile and standalone VR need to be considered for your build, then you will need to take the optimization even further as these devices are very limited in power, whereas web on a gaming desktop can handle much higher quality assets. Mona does not support VR and mobile at this time, so at the moment these are just things to consider.
We will continue to add tutorials on how to improve this in the future, but you can find more information under the unity Development section on the menu to the left.
Unity has three render pipelines :
- Universal Render Pipeline (URP)
- High Definition Render Pipeline (HDRP)
- Standard or In Built Render Pipeline (SRP)
Mona uses the Standard Render Pipeline, it does NOT support the URP or HDRP. This also means that any assets that are purchased on the Unity Asset Store that are designed with the URP and HDRP are not supported.
We don't recommend using 3rd Party assets however as there can be complications with the assets in Mona and the file structure to mint, as well as the licensing issues that may arise. Check the Asset Resources Doc for more information.
Other game engines like Unreal / Godot etc. are also NOT supported.
- For polycount, we recommend keeping your Space below 100k if you want it to work on Mobile or standalone VR (such as the Quest). There are many ways to optimise your space by balancing polycount, materials, textures, etc. so if your space runs well on the Playground (and tested on low end systems) it is acceptable to mint. It is not recommended to test on a high end system and assume it will work well on a low end system however. We are looking at ways to help with this process.
- The recommended size for textures is equal to or less than 2048x2048.
- We strongly recommend NOT using 4096x4096 textures unless absolutely necessary. One 4k texture for a skybox texture would be reasonable, but little more.
- We have found 2K textures or less to be the optimal size to provide a reasonable file size and quality experience for larger assets. Smaller is of course better. Once you have completed your space and have some room to move in both filesize and framerate, then it is possible to adjust these if need be.
- A similar category to this is the baked textures from Lightmapping and reflection probes. You have control over how many and what size these are, so find the right balance between number, size and quality for your Space.
- It is possible to change the size of textures easily inside Unity by selecting the texture and adjusting the size in the Inspector. Use this to help optimize textures for filesize quickly. Note that these changes will only affect the Playable Files filesize. The Mintable files will use the original file. So once you know what size your textures are, make sure to update the texture sizes that you import into the project.
One way to considerably reduce the filesize of textures is to use the 'Use Crunch Compression' at the bottom of the Inspector on selecting the texture in question. Adjust the setting and apply to test the difference in quality to see what works best for filesize VS quality reduction.
Once again, this is purely for the filesize, once the space is loaded it will require the same amount of computer resources.
Realtime lights are very processor heavy and will slow down your space significantly, especially on low end systems. To greatly improve the quality of your space without slowing the space down you can 'bake' your lighting into the scene, this process is called Lightmapping. The only limitation on this is that these lights cannot be used for dynamic objects such as the Avatar.
+ Can be dynamic
+ Affects dynamic objects (like the avatar)
- Expensive on processor (slows down the frame rate)
- Shadow quality is usually quite low (high quality is too expensive)
+ High quality (depending on resolution etc)
+ Not processor intensive
- Not Dynamic
Therefore, it is generally recommended to use 1-2 real-time lights in your space and do the rest with Lightmapping.
Mona uses WebGL in order to run in browsers. This limits some of the functionality and scope that you would usually find in a standard standalone game. You can find a detailed overview of WebGL's graphical capabilities here. If you don't know what these are that's perfectly fine as the Template has all this set up for you. But for those who are interested, Mona uses the following :
- WebGL2.0
- Forward rendering
- Linear Color Space
The following have limitations with WebGL :
- Custom Shaders (see Below)
The following cannot be used :
- Realtime Global Illumination (but baked Global Illumination can be, and is recommended)
As noted, Mona uses the Unity Standard Rendering Pipeline, therefore the Universal Rendering Pipeline Shader Graph cannot be used.
Some builders choose to create their own shaders through a variety of methods for WebGL. As long as the shaders is WebGL compatible then it should work.
Many builders opt to use 3rd party tools such as Amplify, which is a node based shader graph that is available for purchase on the Unity Asset store. Shader Forge is another free tool. These assets can make custom shaders for Mona, as long as they are WebGL compatible.
We generally do not recommend using 3rd Party assets as there can be complications with shaders (among other things) and licensing these is a bit of a grey zone due to the nature of having the Mintable file including some/all of the assets that the owner can then use.
Mona is currently looking into ways to make this a smoother experience for both builders, owners and asset creators. We will update this as we can.
If you use any asset, object, or file in your Space that you did not create, or do not have license to use, you must obtain all required permission to use before minting your Space. Make sure to read all license files carefully.
Now that we have looked at some key factors of creating a space that works well in most situations, let's get to actually making the space!
Last modified 26d ago