How to check which meshes are getting rendered?

I’ve frustum culling enabled on my camera. When I go the edge of the scene, I see only skybox, but in the ministats, the draw calls are are 50. How do I check which meshes are rendered?


P.S. When I check pc.app.scene.drawcalls, it gives me 244 mesh instances, which I think are not relevant to what are being rendered.

Try using https://spector.babylonjs.com/ to capture a frame and see what’s being drawn

2 Likes

I see that some of the meshes in the scene were being rendered which are not in the current view. How do I prevent this?

Are the AA bounding boxes of those meshes in value of the frustum? That’s what we use to test against.

I can’t see the bounding box, since they are instanced meshes through code

@mvaligursky Did you have a script/code that would render AABBs?

Also there is this element in spector capture report


There are a lot of UI Untitiled entities getting rendered which are not present in my hierarchy when I search Untitled in search.
When I check in console, this is the result

Would you be able to provide a link of a build to look at?

I’m afraid I could not. This is a private project of our organization.

The instanced meshes are not culled and are submitted to the GPU at all times. I’ve been thinking about improving the system just yesterday, and have put my thoughts to this issue: Hardware instancing improvements · Issue #4878 · playcanvas/engine · GitHub

But this likely won’t be done for few months.

As a workaround, this might work (untested):

  1. set custom AABB on your render / model component using RenderComponent | PlayCanvas API Reference - this needs to be a single AABB of all instances.
  2. after you set instancing VB on the mesh instance, which disables the culling, enable it back again:
    meshInstance.cull = true;
2 Likes

UI elements create a Graph Node for the mesh instance at runtime. See Engine generated graph nodes in entities (eg elements) causing issues with children length · Issue #4333 · playcanvas/engine · GitHub

1 Like

But I see one Unititled element as the parent of Root, is this because of the same issue?