[FPS drop] Consecutive clicking causes huge FPS drop, some help?

Hello boys, I’m trying to troubleshoot why just clicking on the canvas causes such fps drop.

To reproduce my issue:

The profiling (about 30 seconds of intensive clicking)

Without a close look in the babylon source, I would say that the problem is in the _generatePointsArray, perhaps preprocessing this (if possible) would prevent so many calls to this method. The question is, can I do this? My analysis is correct?

Thanks babys.

This is so weird as the points array should be cached an created only once :frowning:

Could you reproduce in the playground?

This will definitely help us troubleshoot faster and I wonder if it is specific to your model or more general.

I would guess here _intersectTriangles is taking the time in picking cause your mesh is really big:

image

This is a HUGE amount for:

Sure I will try that.
Do you know where can I upload the model?
(Most sites here are blocked, googledrive and onedrive did not work, but I see that you’ve downloaded the model now)

About what you said in the second post:
Are you sure? When I’m outside the building the clicks do not drop the FPS, but when I’m with the camera inside the building the FPS drops…

Anyway, the number of triangles does compromise performance, you are absolutely right, but splitting the mesh into other meshes does impact in general performance, like navigation with the camera.

I can give you the same model, unoptimized, with many meshes and no instances, that would do a worse impact on performance, not only on the click cenario, but the overall rendering performance would be afected, the average FPS would drop significantly.

Unfurtunatelly I still need to use the unoptimized version, because one of my requirements is to select the meshes individually (if everthing is one mesh, I cant select individually).

I still think that the mesh.intersects method is being called for nothing…
Perhaps it’s supposed to check the intersect object, if it exists, and call a onclick event or something like that. Being that or the need of a cache/preprocessing there is room for improvement.

I’m really new in the 3D world and I don’t understand the innerworking maths and shit behind the renderization of a frame, I will keep researching…

Get inside the building, you`re outside hauahuhauhuauh :sweat_smile: