Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Reduce draw calls and shadows tris - any ideas?!

Discussion in 'Editor & General Support' started by rchmiel, Nov 18, 2015.

  1. rchmiel

    rchmiel

    Joined:
    Apr 5, 2015
    Posts:
    49
    I wonder, what I should to do, to reduce draw calls and shadow tris in my mobile game (3rd person with realtime shadows)?!

    What I'm doing:
    > For a few prefabs I'm using one big texture
    > Each prefab has less vertices than 300
    > I'm try to not using transparency shaders

    What else should I do?
    > this same prefabs must have the same rotation and scale? I saw some like that In a few games. If this will help?
    > anything else?!
     
  2. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    First, which version of unity, as unity 5.x changed which features free users can access now.
    Now... let's consider this first; how's the game performing on the target hardware? If it's performing pretty well already, then there may be no need, especially if the target device is low-end, as that will decide how it will perform for the majority of mobile gamers. (Well, the majority of those with low-end hardware...)

    When either you want to optimize more, or if it's not performing as well as you hoped, then here's what else you can consider:
    - How expensive are your shaders? If you're using the standard built-in ones, then you should be good unless you're using something like the standard shader (it's optimized well in most cases, but some special-cases can't handle it) or one of the more expensive built-in shaders.
    - How many lights are you using? If most of them are baked, then this shouldn't be much of an issue, until you have something like 2 or more forward-rendered pixel lights affecting your objects. (This doubles triangles as it has to re-render the objects for each additional light in forward rendering) Deferred rendering fixes this by rendering all the lights in one pass, but this doesn't work on mobile devices. (I hear some can use it, but it's a select few devices that are probably too expensive for the average user)
    - How many of your lights are using dynamic shadows? if it's only one, then you're somewhat covered, as one light is only one extra set of calls. If however you have many shadow-casting lights, things could get a bit slow. This is where lightmap baking shines, as you can have real fancy shadows at no extra cost since they're static ones that only need to be computed once.
    - Having a good UV layout can help cut down on vertices sent to the GPU. This is because UV layouts get edge-splits where faces aren't connected, doubling verts in those areas. This is also the reason why excessive edge-splits can increase the poly count, so use them wisely in your 3D modelling app.
    - Where possible, use batching as this can cut them down further. Also, I recommend setting your static objects up as "batching static" (setting the static checkbox triggers this) As for your vert count, that's low enough for dynamic batching to work, unless you're using a skinned mesh. (These don't batch... :()

    Most of what you have done to reduce rendering costs are good. :) Let me know if you have any further questions. :)
     
  3. rchmiel

    rchmiel

    Joined:
    Apr 5, 2015
    Posts:
    49
    But what you think about prefab with this same scale and roatation?