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

are realtime shadows updated on static objects

Discussion in 'Global Illumination' started by tommox86, May 11, 2022.

  1. tommox86

    tommox86

    Joined:
    Apr 30, 2015
    Posts:
    88
    if i mark my objects as static for background objects that dont move with the shadow be updated every frame or because its marked as static will it only update once or if its casting a shadow on a dynamic object?
     
  2. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    If not using baked lighting, it'll always render shadows every frame.

    If using baked lighting, then it depends:
    1. If you're setting a light to "baked", that means it'll do a full bake, shadows included, so shadows won't be dynamic or update at all.
    2. If you set a light to "mixed" only, then only the indirect light will be baked, shadows will still be rendered dynamically every frame.

    When it comes to shadows, setting it to static doesn't do anything except tell the lightmapper this is a static object, so bake lighting when requested.
    What matters is what mode your light is set to, mixed, baked, or realtime.
     
  3. tommox86

    tommox86

    Joined:
    Apr 30, 2015
    Posts:
    88
    thanks for that. im building for mobile and the light map looks shockingingly bad(no matter what setting i bake. higher res obv means alot larger size also..). i have figured out a way to take a snapshot of static shadows in high res which looks pretty good. the only issue is for dynamic objects, whats a good way to check performance impact for realtime shadows on mobile ?
     
  4. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Honestly not sure as I've never developed for mobile.
    If you can't get good quality lighting from unity's lightmapper, you can use an asset called "Bakery". It provides better quality, and does good AO and most importantly better auto UVs so you don't have to author lightmap UVs for every object.

    Point lights have the most expensive shadows by far, so point lights should definitely only use baked shadows for mobile.

    You can use the unity profiler to measure performance, but it'll be on your PC, not sure how to do it in mobile althoough I'm sure there's a way.
     
    tommox86 likes this.
  5. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Actually nobody is really using realtime shadows on mobile, it's still too expensive on the CPU, espacially Unitys old tech shadows. If shadows are present, it's either baked or it gets faked by using blob shadows (so transparent circle geometry or some sort of decals, and I'm not speaking about the old tech projectors). Some games only using one realtime shadows just to cover the main character/player.