# Change of computing power/ time needed when imported Mesh triangle number changes

I am doing a Unity project, that makes it necessary to import a mesh consisting of triangles. As it is possible to reduce the amount of triangles in a mesh and keeping the structure similar, I am wondering, what the theoretical expectation of the behaviour of the computational time and power would be. So for example, I am using a mesh with 100000 triangles vs. 50000 triangles. In the project a sphere will collide with the mesh at a certain point and time. What would be an approach to what to expect here? (From simply running the project, I did not notice a difference, but I would like to understand what happens "in the background"/ what I can expect for larger amounts of triangles.) Thank you very much in advance!

## 1 Answer

This depends on some specifics.

If the triangle mesh is using a convex collider, then only polygons on the convex hull contribute to the collision detection cost, while interior/co-planar triangles take time to import but are effectively ignored in collisions.

If the mesh is static, the physics engine may be able to sort it into an acceleration structure that lets it check only "nearby" triangles for collisions, rather than the full collection. So here it's the density of triangles per unit volume that matters, not necessarily the total number. (Though a larger number will still take more time and memory to import/load/distribute into the acceleration structure)

The best way to find out for your specific use case would be to take a simple mesh representative of what you'll be working with, then make a copy of it which you subdivide to some high degree. Make sure it stays curved or bumpy after subdivision, to deny Unity opportunities to auto-simplify some of the small triangles back to fewer, larger triangles in flat areas.

Import each mesh into an otherwise-identical scene where things will collide with them, and run the profiler to measure the exact time cost of the physics update in each case. Run several trials to control for flukes. Then crank up the subdivisions and try again. This will let you empirically plot the performance curve as it manifests for the collision scenarios you're using.

• Ok, thanks for the answer, I didn't realize what the profiler could be used for. I will try it. Sep 22, 2023 at 11:46