How to optimize performance for complex 3D scenes in Babylon.js?

Hey guys… :smiling_face_with_three_hearts:

I am working on a project where I need to render a fairly complex 3D scene with a lot of objects, textures, and lighting effects. While Babylon.js has been amazing so far, I’ve noticed a drop in performance when adding more assets to the scene. My frame rate starts to drop, especially on lower-end devices.

What are the best practices for optimizing performance in Babylon.js? Specifically, I am wondering about:

  • Efficient handling of large numbers of objects
  • Managing textures and reducing memory usage
  • Strategies for handling dynamic lighting/shadows without a huge performance hit
  • Any useful tips for optimizing the rendering pipeline in general

I also check this: https://forum.babylonjs.com/t/ideas-for-rendering-and-optimizing-complex-scenesservicenow But I have not found any solution. Could anyone guide me about this? I am relatively new to this, so any advice or resources would be super helpful.

Thanks in advance!

Respected community member! :smiling_face_with_three_hearts:

This is a clich é d issue, there is no universal best practice, and we can only find the bottleneck of scene rendering and optimize it ourselves. Usually, we start from these aspects: streamlining instances, freezing grids, shadow distance, camera distance, etc., in short, reducing drawCalls.

1 Like

i understand you are new to this and looking for information but all the points you listed wanting help for cannot realistically be answered in one shot. These are all major topics on their own that will take some time of research and practice to get right. Start with the babylon documents. Then perhaps take one point at a time and start searching the forums and the internet. maybe you will find some condensed info on such matters , but even then it might be very project specific. So nothing you can copy and paste and problem solved etc…

I think best to start with getting BABYLON.inspector running, or instrumentation like this https://playground.babylonjs.com/#938RNX#29 (o7 whoever suggested/made it), and record your performance in the browser DevTools to find bottlenecks.

Otherwise probably people could comment on specifics if provided. :kissing_heart:

We try to centralize all ideas here: Optimizing Your Scene | Babylon.js Documentation

There was a very well-done post recently about optimizing memory usage. Talks about some of the points you mentioned. I’ll just leave it here :slight_smile:

1 Like