Search Unity

Directional lightmaps and shadows

Discussion in 'Developer Preview Archive' started by pixoloco, Dec 27, 2011.

  1. pixoloco

    pixoloco

    Joined:
    Dec 22, 2011
    Posts:
    47
    Is there a way to have realtime shadows from dynamic object on static object with directional lightmaps ?

    Here's what i mean :
    $dirlightmaps.jpg
    All objects are static except the sphere.

    1) Directional lightmaps, directional light in auto mode
    2) Dual lightmaps, directional light in auto mode
    3) What I want. For that result, i had to replace the Color lightmap of 1) by the Near lightmap from 2) and put the directional light in realtime only mode.

    So is there a way to achieve some kind of dual directional lightmaps :) ?
     
  2. robert

    robert

    Moderator

    Joined:
    Dec 21, 2008
    Posts:
    265
    If you switch to forward rendering in 1), you should actually get the shadow. Have you tried that?

    The main reason for introducing directional lightmaps was to have an alternative to dual lightmaps that still handles bump and specular, but without the need of rendering any lights realtime. But I understand where you're coming from: in your case it would probably be nice to leave the directional light as auto in dual mode, while having all the other possible lights baked only. You can't set that up automatically in Unity yet, but it's something we're considering.

    Anyway, instead of getting real shadows from the directional light you can get a "fake" shadow single lightmaps style if you switch to forward rendering. It doesn't look as good as a proper realtime shadow which you would otherwise get in dual lightmaps, but it's much cheaper to render. Is that good enough for you?
     
  3. pixoloco

    pixoloco

    Joined:
    Dec 22, 2011
    Posts:
    47
    Thanks robert.
    I'll stay in forward rendering then. The only prob is that only directional lights can cast shadows in forward rendering.

    While you are at considering things :p, would it be possible somehow to be able to cast fake shadows from light probes ? *grin mischievously*
     
  4. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Or....dual directional lightmaps :p
     
  5. actuallystarky

    actuallystarky

    Joined:
    Jul 12, 2010
    Posts:
    188
    You do not need dual directional lightmaps. There's a better alternative to that brute force solution. My proposal -

    Single lightmap mode with directional lightmaps. Add the ability to flag certain lights to bake only indirect lighting. Those lights then cast real-time light and shadows.

    Perfect shadow integration. Normal maps / per pixel effects in shadow. Decent performance.

    Please?
     
  6. why789

    why789

    Joined:
    Sep 23, 2011
    Posts:
    184
    I would like to be able to use directional/single lightmaps but have them cast shadows on baked objects and still be in deferred rendering path!! that, or be able to have multiple lights cast shadows in forward.

    I believe in 3.4 you could cast realtime shadows in deferred onto a baked surface with single lightmaps. That might have been due to a "bug". If so, bring the bug back please!! (or achieve something similar!)

    Please and thank you!!
    why789