My experience in Babylon performance optimization and problems encountered

My computer configuration: i7 6700 GTX 1060 6G 16g RAM.
My scenario:


Scene Description: the wall is generated by extrudepolygon, the floor is created by createpolygon, other devices are 3D Max exported gltf, and cabinets and doors are animated.

The necessary functions of the scene: highlight, change color and translucency of the device.

Here are the optimization methods I used:

  1. Device clone(), material. Freeze(), donotsyncboundinginfo = true, freezeworldmatrix().

Finally, FPS: 10. Although unfreeze() can meet the necessary functions, FPS is too low to run smoothly.

  1. Device createinstance(), material. Freeze(), donotsyncboundinginfo = true, freezeworldmatrix().

Finally, FPS: 35-40, which can basically run smoothly, but can not meet the necessary functions (highlight, change color, translucence). The 4.1 beta has been able to change color with instancedbuffers.

  1. Combined all the walls on the basis of 2

Finally, FPS: 53-60, running smoothly. However, the required functions cannot be met, and the loading time is increased by 50%.

Where Babylon is not friendly: all operations are based on mesh, which is very tedious for complex objects such as cabinet (with power on cabinet door animation, multi grid combination). Here are some tedious Codes:
d
Although it’s not so troublesome to create instance now, it’s still tedious to operate complex objects.
What I want to solve now:

  1. How to set highlight and translucency for the instance? With hasvertexealpha = true, instancedbuffers can be translucent but only valid for blue, and opaque is invalid.

  2. How to speed up the merging of meshes?

  3. Can my scenario be optimized with SPS? Multi mesh composition, how to use SPS for animated objects?

  4. Are there any other optimization methods for my scenarios and the functions I need?

Finally, thank you very much to the team of Babylon for realizing such a beautiful computer room on HTML5

2 Likes

I would almost tune down from that 60fps model

I wonder if you could directly author your model to keep those optim away from for instance merging meshes and so on at runtime ?

If your scene is complex to build, it is probably better off done offline.

This is a good way. I think I can export the merged wall to gltf before using it.

1 Like