How to know how many triangles are in a given area?

I have a little problem with lag on my game on mobile.

The game is playable on both mobile and desktop but I would prefer it if smooth gameplay could be done on mobile as that’s where I want to target most of my player base from. Anyway the problem is that in certain parts of my map there is noticeable lag, on average my CPU would be hovering 15-20 ms and then suddenly spike to 53 ms in certain rooms which is a whopping 100% increase in lag.

E.g. I would walk into an office room where there are office drawers. These drawers have handles which are made of Cylinders and when I look at 15 of these drawers containing these tiny handles my lag would spike. From my understanding these cylinders are most of the reason for the lag.

Summary
I want to know how to find the triangle count in a given area so that I can put LIMITS on my building so that I don’t run into any lag.

This means getting the combined triangle count of parts, cylinders, wedges, etc in a box like area.

3 Likes

Don’t you happen to have humanoids in your objects? (where they should not be)

If you are perfectly happy with them and they have no moving parts in them, union them into 1 piece. So a 100 part object would become 1.

I wouldn’t suggest just unioning them. If you union 100 parts, the triangle count would be a lot higher. And If you do want to union them, please optimize them in a 3D modeling program.

1 Like

This is helpful: Mesh Optimization Tools - Roblox

I used the 100 object as a example. It’s actually really simple and easy. And can be reversed

Unioning a large number of parts is not the solution to poor performance - this is a bad idea.

BaseParts are already very optimized because of their consistent geometry. Turning lots of Parts into a Union means a shape with much more complex geometry will need to be loaded, increasing load time with zero performance improvements because you’re not decreasing the triangle count. Unions and Parts are not equivalent.

A much better solution would be to import the handle into 3D modelling software, decrease the triangle count, and re-import it as a mesh (assuming you can’t just decrease the Part count). Fewer triangles will help to conserve memory budget and IIRC a single MeshID only needs to be downloaded by each client once, regardless of how many times you use the asset.

Managing your work by triangle count is probably unnecessary - the MicroProfiler might offer you more relevant performance metrics. Consider using Box collisions (or just disable the collisions altogether) for smaller, higher-poly assets like your handles. Aside from actively reducing triangle count where necessary it’s also good practice to follow other optimization methods to conserve memory usage in the future.

2 Likes

Never ever do this. This severely increases your memory usage, the instance count is lower but CSG tries to be smart and ruins the tri count, also the hitbox starts to look like an NFT if you don’t want it to be really strange and different from the physical model.

1 Like

I wish there was an ‘easy’ way to do this in Studio. Unfortunately, the only way I know to get the tri-count of an object is to export as .obj file, then open that file in Blender to see the total tri-count, face count, etc. That is the only reason I installed Blender.
It is a little cumbersome procedure just to get a simple data point, but it works. Anybody have a better way?

Also, you can select multiple parts or meshes or a ‘model’ of many parts as a single obj file and get the tri-count of all the parts exported in one obj file.

Did you make these drawer handles? If not, and if they are a meshpart, the person who made them may have used too many faces/triangles. I analyzed a simple ‘gift’ box that was in the library, and it had tens of thousands of triangles. The box had rounded edges that were ultra high poly!. A simple box can be a lag source if you didn’t create it and you don’t know how it was created.

They took what could have been 12 tris and made it 100,000 for a bit of rounding that was barely noticeable with the size of the item and viewing distances.