|
Hi there, I have some people who says parts of a level is slowing the FPS down. As the users can build the levels themselfs, I would like to examine the FPS and verts/tris in certain areas/levels. I have a FPS running now, but how do I calculate the verts/tris run-time in a scene? I cant find anything in script reference, so I guess its gotta be manually somehow. Is it "for each child gameobject in scene, calc verts/tris and check every child within too recursively" ? if so, where do I find the verts and tris?
(comments are locked)
|
|
The Mesh-class has all you need. Every mesh is made up of vertices and triangles. With Mesh.vertexCount you can get the vertex count of this Mesh. The triangle count can only be queried by reading the length of the Mesh.triangles array and divide it by 3. To get the overall vertex / triangle count in the scene just use this: awesome! I found another script that did some calculations too, but it doesnt count all my dualsided alpha leafs I think or something else, because the editor shows one thing and the counter another... strange! Will try this one now. Thanks!
Sep 18 '11 at 10:19 PM
BerggreenDK
still get different stats from the view inside the editor and then this script. any clues to why?
Sep 18 '11 at 10:27 PM
BerggreenDK
Well, the statistics in the editor are the true vertices and tris that are send to the graphics-device. Frustum-culling and occlusion culling will reduce the vert / tris count. On the other hand there are some things you almost can't track: the GUI! Every GUI element have at least one drawcall, a button usually have two, one for the background-image and one for the text / image. There are even other things that causes draw-calls like particles, cloth, GUITextures... I'm not sure what you want to achieve? The vertex or tris count doesn't say anything about performance. Draw calls are the real problem. If Unity can batch a lot stuff into just a few drawcalls you can have millions of vertices. Also very important is what shaders you're using. If you have a bad combination of transparent shaders you will have a high fillrate (due to many overdraws)
Sep 19 '11 at 02:02 AM
Bunny83
drawcalls? batch... oh crap! I have around 500 drawcalls because our world is build up of small instatiated objects that grouped with a section parent.
Sep 19 '11 at 07:57 AM
BerggreenDK
yes, we have some bad(expensive) dual-sided alpha planes used for leafs on trees. Have thought of doing them as a "face the cam" plane instead and reducing the numbers.
Sep 19 '11 at 07:59 AM
BerggreenDK
(comments are locked)
|
