Search Unity

Best shadow practices for top down scene?

Discussion in 'General Graphics' started by RR7, Jul 10, 2021.

  1. RR7

    RR7

    Joined:
    Jan 9, 2017
    Posts:
    254
    I have scenes which are top down 3d (slight angle), some scenes are night lit by multiple streetlamps, around 20 spot lights.

    the entire scene is always visible, the camera doesn't move, the scenery is static with player objects and moving around.

    most guides on shadows, and baked shadow options seem geared towards FPS games, so far nothing i try seems to yield the right results.

    what would be the best way to approach a game like this, just fully realtime and suck it up? i cant set the street light shadows to OnEnable as i have a few realtime objects that need them.

    shadow mask, looks like the best option but most of my lights just get disabled when i bake, if i reduce the range on the spots the number of visible ones increase, some kind of overlap, blending issue?

    i have tried creating shadowproxy objects and meshcombine them, this reduces the draw calls and shadow casters a lot, but actually make performance worse, not sure why, maybe a single massive mesh is a problem to render a shadow from.

    any help appreciated here, as nothing i do really seems to behave as i'd expect.
     
    Last edited: Sep 22, 2021
  2. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    @RR7
    For objects that don't move, hand paint the shadows for those unmoveable objects, onto the enviroment/floor texture. You can take the enviroment, or the texture used for your scene into photoshop, and paint fake shadows onto it.

    But for objects that move, you could allow the lights/lamps to cast shadows in real time, provided that there are not too many moveable objects.
     
  3. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Hope that helps.
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Cached shadow maps. They're all realtime but don't cost anything unless you move the light or change some stuff in the list for cached objects. It's available for HDRP and coming next for URP.

    Is it even show just doing it realtime for top down? I doubt anything gets faster than that.
     
  5. RR7

    RR7

    Joined:
    Jan 9, 2017
    Posts:
    254
    sorry i forgot about this thread. so drawing shadows manually may work but i'd need things more finalized in my scene before thats feasible, i havent gone deep into it though, so if its the best idea ever, i may not come to realise that yet :)

    Cached shadows seems like it may work, i do seem to remember trying ti out before and not really seeing anything tanglible but that was before i was on my lean pass, and i think i had other factors causing major issues that are now not present.

    i will try a build in 2021.1 and see if it helps, my problem there is if it does, i'm kinda stuck on 2020.3 as its the last LTS i'm able to use ;)

    as for "Is it even slow just doing it realtime for top down? I doubt anything gets faster than that." well, it depends i guess, if i have lots of cars with headlights on, then the shadows for that become expensive, if i could save some frame time on the all the things that don't move, it may free up enough time for these to be feasible instead of having headlights shine through things.
     
    Last edited: Sep 22, 2021