Jump to content

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?

 

 

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.

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.

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!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...