Search Unity

Optimizations/tricks about what to check to get better framerate?

Discussion in 'World Building' started by rapidrunner, Jun 4, 2018.

  1. rapidrunner

    rapidrunner

    Joined:
    Jun 11, 2008
    Posts:
    944
    I have so far the following:

    - 1 unity map (4096x4096) created via Gaia
    - speedtree added via Gaia, same for grass and flowers.
    - Few clusters of buildings (forgot the name, got them from the store, they are exterior only buildings; some from a urban set, some from a suburb set)
    - Enviro and Aquas

    So far, the game without buildings, run at decent framerate; like in between 90 and 70 (depending if I am in a dense forest area or not), although once I start to add buildings, the framerate drop dramatically in the 10-15 range. I do have a gaming rig, with a latest gen i7 and a 1070 GPU, with 32 GB of RAM.

    Most likely I am missing some optimization here, so what should I actually look for, to figure out what is slowing down things? I can see the draw calls and the polygon number, but I get no clear reference about what to do to increase the framerate and optimize. I did load the assets demo scenes and they are running fine, at a good framerate; while when I import the same content of the demo scene on my terrain, I get these slow downs.

    Assuming that these are asset store items, I thought they were optimized already, so the reason for the slow down must be something I am doing. Any guidance would be appreciated; I did start to look at so many things and it is rather disheartening to try stuff at random without being able to figure this out. Thanks in advance.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    Check with Profiler first.
    And Frame Debugger can show the reason why objects are not batched together.

    also i wouldn't assume asset store models are optimized, unless it specifically says that..
    (like having lods, optimized materials / shaders, texture atlases etc)
     
  3. rapidrunner

    rapidrunner

    Joined:
    Jun 11, 2008
    Posts:
    944
    Thanks for the reply; I didn't even realize that Unity had a profiler integrated in it.

    The interesting thing that I see (being my first time using the profiler), is that I get 2 enormous slowdown from

    - camera render.Culling.SceneCulling.CullSendEvents.AQUAS_refliction.OnWillRenderObject()
    - camera.Render.Drawing.Render.OpaqueGeometry

    The first one is accounting for 39.17ms, while the second is 32.69ms. Most of the second slownes is coming from RenderDeferred.Lighting, RenderDeferred.GBuffer and Shadows.PrepareShadowmap.

    So the issue was not the meshes, but the reflections in Aquas and the Lighting?

    aquas.JPG
    render opaque.JPG
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    rapidrunner likes this.
  5. rapidrunner

    rapidrunner

    Joined:
    Jun 11, 2008
    Posts:
    944
    Brilliant! So the issue is not in the buildings at all, but in the reflections from Aquas.
    I will try to move elements in a different layer, as the linked post did point out.

    Regarding the lighting, what else can I do? I assume that these calls are realtime lights?