Mesh scale - how does it impact performance?

I am wondering if making everything in my game larger or smaller makes any difference to performance. I could make everything larger and make the camera move faster and be further away, or I could make everything small and be close up, but is there an ideal way of doing things in this regard?

Also, I am so new to 3d graphics that i am not sure how many polygons I should have in my models for optimal performance. Is there some kind of formula for babylonjs that I can use? So like if I want 100 distinct meshes in my scene and I am running on mid-tier hardware, I can have up to X polygons per mesh?

I really feel like I am in the dark about this stuff and I don’t want to make a bunch of new models and find out I should have made them more detailed or less detailed, etc.


I would love to have som of that information too … maybe some “optimization manual for beginners” as there are so many aspects to consider.

  • I think that scaling should not matter as everything in WebGL is supposed to be relative.

I have to say that I am surprised how quickly I found hardware limits … even small simple scene struggle to run at 60FPS when there are 3 lights and one shadow :-/ It seems to be far from native-app performance-wise.

Yeah this is what I worry about. I am developing on a gaming pc with a GTX1060, so while it runs great for me that probably isn’t the case for a lot of other hardware.

So first of all you have to read that:

Then to your question: the scale is like rotation and position, it will generate a matrix used during rendering. So it had no impact on performance at all

I will encourage you to use small scale scene because there is more precision with smaller floats than bigger (due to how float number are stored in the GPU)

For your overall question there is no magic answer. You will have to test to determine if you have (or not) a perf issue then using the doc I linked you can find counter measures.

If perf is an issue you have to check if it comes from the CPU (so somewhere in the is code) or from the GPU (so shaders). A good truck is to reduce the resolution. If perf are better then you have a going bound app and then you need to reduce complexity of your shaders (less lights, no shadows, reduced resolution, using instances etc…). Else you must use the f12 profiler of your browser to find the culprit


Thanks for the advice.

When you encourage me to us a small scale scene, what does that mean, exactly? What is considered small scale? Are we talking about the dimensions of the entire scene, for example? Or are we talking about the size of individual meshes? In either case, what is “small”?

Is a scent 1000 units in all dimensions large or small?


it is average :slight_smile:

I would recomment to keep the camera.maxZ around 1000 for a regular scene so you won’t end up with depth fighting issues

Some details in the log depth article: Babylon.js Documentation - Use Logarithmic Depth Buffer

Thanks Deltakosh for your help. That optimization document has a lot of good stuff in it.