Is there a way to print out which objects cause draw calls?

Hi everyone!

Quick question; is there a way to print out which objects cause draw calls? I’m meaning that I can get the total sum of draw calls easily, but after there is like 170 draw calls in the scene it would be nice to see what objects cause these to be easily able to optimize. :sunglasses:

1 Like

Have you tried SpectorJS? You can see the individual commands there after starting a capture:

Disclaimer: It’s possible there’s a better (more user-friendly) way. I’m not an expert when it comes to WebGL :slight_smile:

2 Likes

Sound like a good option for me if I can kind of easily decipher it… :slight_smile:

What I would just need is to see what entities make how many draw calls. Would be so easy to see that “ok this object should not have this many draw calls” and things like that.

You could try logging the draw count for each mesh using the beforeDraw callback to keep count, maybe like this for a simple example/ starting-point. :slight_smile:

And here’s another version that just logs the mesh draw counts once for the next frame when you press ctrl-d (after clicking on the canvas). :beers:

1 Like

Nice utility :slight_smile:

2 Likes