Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suboptimal performance with EXT_mesh_gpu_instancing #8164

Closed
zeux opened this issue May 13, 2020 · 2 comments
Closed

Suboptimal performance with EXT_mesh_gpu_instancing #8164

zeux opened this issue May 13, 2020 · 2 comments

Comments

@zeux
Copy link
Contributor

zeux commented May 13, 2020

I've been testing instancing using models provided in KhronosGroup/glTF#1699; attached is the ice stadium model encoded using EXT_mesh_gpu_instancing.

stadium.glb.zip

After conversion this scene has 583 nodes with a total of 610 mesh primitives, but many of these are instanced; the cumulative instance count is around 27K.

three.js has an open PR for support of this extension; using that, it takes ~140ms to fully deserialize the file including mesh parsing etc., and ~3ms each frame to submit draw commands to the GPU, with scene looking a bit like this

image

In comparison, Babylon.JS takes ~16 seconds (~114x longer) to deserialize the file, and ~55ms (~18x longer) to render each frame on the CPU. The GPU cost looks comparable, maybe better on Babylon side.

Here's a breakdown of loading process, with a separate section for createDefaultCamera (it seems to run into some sort of N^2 behavior?), and a few other expensive bits:

image

image

Here's a breakdown of a single render frame:

image

The most severe issues here are the problem with createDefaultCamera and the render frame performance. I'm wondering if Babylon.JS provides a more efficient way to represent instanced draws? Right now it looks like the loader just creates a node per mesh, and presumably then relies on auto-instancing functionality to dispatch draw calls more efficiently, but it looks like the scene graph checks are not very fast here.

@deltakosh
Copy link
Contributor

Thanks a lot! We are currently working on improving (drastically) the situation. We will report here asap

@Popov72
Copy link
Contributor

Popov72 commented May 19, 2020

Fixed by #8208 and #8209.

Let us know how it comes for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants