Sign in to follow this  
thrice

Understanding draw calls (and improving FPS)

Recommended Posts

So I've been trying to improve performance in my scene. Been stuck at around 40fps consistently. I am making a card game, so there are a lot of planes, with a lot of materials (the images for the cards), as well as each card in hand / on board having its own set of attributes.

Anyways, I was under the impression that scene.engine.drawCalls, was the number of things babylon would redraw, or check to see if it was dirty or whatever, everytime the render loop runs. Now I'm not so sure, because after reducing my draw calls from a minimum 350 when I load my scene, to 200, I haven't really seen a FPS boost.

Before I continue to refactor to reduce the number of draw calls, I figured I would ask, am I missing something here? Or is that still a large number of draw calls, which could be causing or contributing to the low FPS?

 

 

Share this post


Link to post
Share on other sites

Hi @thrice

Drawcalls have a big impact, especially if you're also targeting mobile / tablet / low-end laptops etc

Texture wise, it would be optimal to only have one, e.g a spritesheet/texture atlas to really knock away some drawcalls.

Geometry wise, using fewer and simpler models and instancing >(or) cloning where possible.

Share this post


Link to post
Share on other sites

Each material per mesh(or instance thereof) is basically one draw call. 

Seconding @aWeirdo, having all cards of the same suit in one large texture would likely reduce draw calls by a lot. If you do this, you'll probably want to use SPS to get the draw call reduction benefit.

I assume many cards will only be visible from the back, so they can all be collapsed onto one draw call.

Share this post


Link to post
Share on other sites
On 7/30/2017 at 5:33 PM, aWeirdo said:

Geometry wise, using fewer and simpler models and instancing >(or) cloning where possible.

Thanks for the tips. I think the initial not seeing FPS improvement was also due to electron, which behaves really strange w babylon sometimes (like sometimes when scene is loading, fps will just tank to like 30 and never recover, until I minimize window and bring it back to the foreground).

Anyways I'm down to 150ish draw calls now and seeing 50+ FPS for the first time in quite awhile!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.