Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Real time shadows together with baked lighting in RC2

Discussion in 'Unity 5 Pre-order Beta' started by kurzemnieks, Feb 17, 2015.

  1. kurzemnieks

    kurzemnieks

    Joined:
    Nov 22, 2012
    Posts:
    16
    Hi. We are working on an outside environment where we need baked lighting + real time shadows on static objects from non-static objects.
    I was testing how real time shadows work in different scenarios. I did this a while ago in some earlier unity5 beta and was hoping that there would be an usable solution now, but not much has changed, so I am wondering what is the solution for this case?

    My basic test scene is - two static objects (ground and blue ball) and one non-static (red ball). One directional light with soft shadows. All object have cast and recieve shadows on.
    I tried all lightmapping types and both forward and deferred rendering.

    I attached screenshots from my test. As you can see, realtime shadows on static ground works only in forward rendering with non-directional and directional lightmaps. We need to use directional-specular lightmapping so all materials would look correct.
    In deferred mode there are no shadows on the ground at all, but there are shadows on the non-static object (which is nice).

    unity5 seems great so far, but what about this ?
     

    Attached Files:

  2. andybossa

    andybossa

    Joined:
    Feb 19, 2013
    Posts:
    5
    Hey kuzemnieks, I'm seeing the same issue here.

    I tried to troubleshoot this in a brand new scene with 2 cubes. With the directional mode set to 'Directional Specular' I lose shadows. The other two modes seem to display shadows fine.

    However in my own scene any lightmap static object won't receive dynamic shadows.
    enlighten.jpg
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,169
    I would like to draw your attention to a specific post made by someone from Unity on a thread which I believe overlaps strongly with what you are asking about. Apologies if I've made a mistake somehow and this isn't relevant:

    This is the link to the post

    I am currently appealing on that thread for an update from Unity as to what exactly is going on with this feature.
     
    Last edited: Feb 20, 2015
  4. andybossa

    andybossa

    Joined:
    Feb 19, 2013
    Posts:
    5
    Ah yes thanks for that elbows. It seems to be the same issue.

    I've seen mentioned elsewhere that a work-around is to have two lights instead of one, one marked as baked, the as realtime. To my understanding this will produce similar results to mixed lighting in 4.x...

    Although like you, I want a solid answer for this one :)
     
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,561
    Well, I tried this and it doesn't produce the same results. By doubling up your lights (and cutting the light intensity of each light in half, the "realtime" shadows are only half as intense as the baked shadows. It appears that the static objects cast realtime shadows over the baked shadows making them much darker, and the non-static geometry doesn't get lighting from the "baked" light at all, so the shading is different. Setting the "baked" light to Mixed mode solves the shading issue, but still leaves you with a shadow that is very light compared to the baked+realtime shadow.
     
  6. andybossa

    andybossa

    Joined:
    Feb 19, 2013
    Posts:
    5
    That's a pain...
     
  7. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,561
    Well the only way to make this work is to switch back to "Legacy deferred" mode. Then, it works perfectly. You can also switch to forward mode, but then the dynamic shadows are drawn over the top of the lightmaps. Still not too bad. I think I can work with it as is.
     
  8. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    I wish they would fix this :(
     
    seattlebluesky likes this.
  9. seattlebluesky

    seattlebluesky

    Joined:
    Sep 2, 2014
    Posts:
    170
    Me too.
     
  10. andybossa

    andybossa

    Joined:
    Feb 19, 2013
    Posts:
    5
    I get these problems in Legacy Deferred.
     
  11. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,031