Optimizing Assets
The Hyperfy engine heavily relies on client-side processing to deliver an immersive experience.
The user experience in world can be significantly impacted by the optimizations of the models and other components set up in the world.
To provide the most users with the best experiences, we recommend the following focus areas for optimization:
- Reducing the size of texture
- Reducing the number of draw calls
- Reducing the number of triangles
- Reducing collider complexity
Measuring Performance
Press the ~ button in world to pull up live world performance statistics:
- Frames per Second
- Draw Calls
- Triangles
- Geometris
- Textures
Improving Performance
The following are focus areas to improve performance of models rendered in world.
Draw Calls
| Draw calls are necessary, reduce them.
Draw calls are requests made to the graphics API to render objects on the screen. Inefficient configuration of a model will lead to excessive draw calls when a single consoldiated call could be used.
Performance | Latency Range |
---|---|
Perfect | < 100 |
Great | 101-300 |
Good | 301-600 |
Uhh | 601-900 |
Unoptimized | 901+ |
Textures and Meshes
| Textures are great, jpeg them.
Performance | Latency Range |
---|---|
Perfect | < 100 |
Great | 101-300 |
Good | 301-600 |
Uhh | 601-900 |
Unoptimized | 901+ |
Triangles and Polygons
| Triangles are great; decimate, retopo, or bake them.
Performance | Latency Range |
---|---|
Perfect | < 100k |
Great | 101-200 |
Good | 201-300 |
Uhh | 301-500k |
Unoptimized | 501k+ |
Collision
| Physics are great; select colisions appropriately.
Collision Setting Optimization
Ask yourself “Do I really need a collision on this object?” if you can get away without one, do so by setting collision to Nothing. If you do require collision, consider the appropriate level of collision required to be calculated by the engine:
-
Static - For basic objects that will not move such as buildings, walls, or trees use static collision. This is the most common type and requires the least computation for object collision.
-
Kinematic - For objects that you want to control through code (e.g. a moving platform), use kinematic. This will allow the collider to move (i.e. the collider’s position is updated as it moves) but is computationally cheaper than dynamic.
-
Dynamic - Use this when you want to create objects that react in a physically accurate way. Think: balls that get kicked/moved by players, cars that crash into stuff etc. It’s very computationally expensive so use this option sparingly.
Collision Mesh Optimization
Regardless of which collider setting is used, make sure you create simple collision meshes rather than the original model. Fewer vertices is definitely better here! Make really simple collision shapes if you can.
Don’t model every detail, it’s rare that you’ll need a super-detailed collision mesh. Less is more! For example, if you don’t allow players to fly you don’t need collisions above where they can walk/run/jump. It’s just a waste of compute. So for a big tree just add a 3m tall cylinder/box (no endcaps!) to where the trunk is. This will stop people running through it but will be cheap.
Other Factors
Other factors that impact performance include:
-
Lighting and shading - bake where possible
-
Skybox HDR - similar technique to texture optimization; ideally fit into 128x128 or up to 2k for best overall performance
-
Animation and rigging
-
Number of users and their avatars - plan the experience and anticipate the number of users intended; provide optimized avatars for higher volume of users
Hyperfy Engine Optimizations
The Hyperfy engine provides the following further optimizations:
- Automatic GPU instancing where thousands of duplicates of the same object only result in 1 draw call.
- Linked duplicates (cmd+D in Blender) are also optimized down to a single shared draw call.
- Frustum culling is applied with a few exceptions so meshes that are outside of the camera frustum do not get drawn. Occlusion culling is not currently supported.
- Level-of-Details (LOD’s) are respected and can be configured from 3d tools such as Blender.
Optimizing Avatars
VRM’s should be less than 4mb and less than 20k tris
Additional resources to build VRM avatars:
Links to Optimization Tools
Links to Other Resources
- Optimizing your Mesh by MONAVERSE
- Super optimizing GLB files using Texture Compression with ZenCompress
- Demo: https://www.khronos.org/gltf/gltf-asset-auditor/
- Recommended Schema
- Publishing guideline summary:
- 3DC Asset Creation More details
- Optimizing Webaverse Island in Blender
- SugarClub.eth Optimizing base mesh avatar
Technical Considerations for Worlds
- File size
- Number of triangles
- Draw calls
- Minimum system requirements
- Optimal browser configurations
- Limiting world file sizes