Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Performance optimization for heavy scenes

Discussion in 'Editor & General Support' started by LeFx_Tom, Nov 13, 2013.

  1. LeFx_Tom

    LeFx_Tom

    Joined:
    Jan 18, 2013
    Posts:
    88
    Hi,

    i'm not entirely sure, whether i'm picking the right forum here or not, but i want to ask for some help here.
    We are working on a VR-Viz-Solution for a client of ours and research the viability of Unity for that task.

    We got our basic scene setup up and running by now as well as the basic import/export pipeline.
    But we are hitting massive performance problems here.

    We used the profiler to check....and we are very aware of the fact, that our scene is somewhat extreme and not perfect...but it is the way it is, because of our data foundation that we have to work with and the demands of our client.

    We have a demo scene running (unfortunately NDA bound models in there, that don't allow for any sharing here)...
    The scene consists of 16.0 Mio Verts, 13 Mio Tris and produces about 10.000 draw calls at the worst viewing angles.
    I know, that this is rather extreme and we are seriously looking into ways to reduce those numbers, but we also would have hoped for unity to scale a bit better with the whole situation.

    Even on our most potent rig (Xeon E3-1230v2, 4*3,4 GHz, 32 GB RAM, GeForce GTX 670 4GB VRAM) is not able to get a stable 20 fps.
    We also noticed a rather big difference of FPS between editor and Build...with same display resoultions, the game mode in editor runs about twice as fast as the standalone build.
    The 20-40 fps are only achieveable in editor which worries us even more...

    The main problem seems to be the CPU-Performance, when looking into Unity's profiler. It says that the main bottleneck for the FPS seems to be the Render-Process on the CPU, which i assume has to do something with object-sorting and handling.
    Can we - by any chance - hope for some way to improve our scene-performance?
    We didn't even try any heavy stuff like multiple lights or heavy shaders. Changing between Forward or Deferred shading also doesn't help much.

    Oh...and if i hit the wrong forum with this one, feel free to move it. Thanks
     
  2. Brenden-Frank

    Brenden-Frank

    Joined:
    Aug 5, 2012
    Posts:
    110
    You need to substantially lower your drawcalls.

    Unity runs primarily on a single thread. Dealing with 10k objects is a bit much. You should be around 2-4k max. Look into static batching if the objects don't move and dynamic batching if they do.

    http://docs.unity3d.com/Documentation/Manual/DrawCallBatching.html

    There's some api calls you can use to combine objects into single meshes as well.

    http://docs.unity3d.com/Documentation/ScriptReference/Mesh.CombineMeshes.html
    http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.PackTextures.html

    Once you get those things out of the way, your only concern will be fillrate on your GPU.