mahesh
November 23, 2022, 12:20pm
1
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.
yaustar
November 23, 2022, 12:24pm
2
Try using https://spector.babylonjs.com/ to capture a frame and see what’s being drawn
2 Likes
mahesh
November 23, 2022, 12:34pm
3
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?
yaustar
November 23, 2022, 12:43pm
4
Are the AA bounding boxes of those meshes in value of the frustum? That’s what we use to test against.
mahesh
November 23, 2022, 12:47pm
5
I can’t see the bounding box, since they are instanced meshes through code
yaustar
November 23, 2022, 12:49pm
6
@mvaligursky Did you have a script/code that would render AABBs?
mahesh
November 23, 2022, 12:56pm
7
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
yaustar
November 23, 2022, 1:05pm
8
Would you be able to provide a link of a build to look at?
mahesh
November 23, 2022, 1:06pm
9
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):
set custom AABB on your render / model component using RenderComponent | PlayCanvas API Reference - this needs to be a single AABB of all instances.
after you set instancing VB on the mesh instance, which disables the culling, enable it back again:
meshInstance.cull = true;
2 Likes
yaustar
November 23, 2022, 2:01pm
11
1 Like
mahesh
November 24, 2022, 7:06am
12
But I see one Unititled element as the parent of Root, is this because of the same issue?