Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Baking light into prefabs

Discussion in 'Unity 5 Pre-order Beta' started by LaneFox, Dec 28, 2014.

  1. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    Probably not a 5.x specific question, but anyway..

    Can I build prefabs of rooms and baked their lighting, then put them into any scene later with other rooms that have been separately baked?
     
  2. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    You can't lightmap prefabs using Unity's built in lightmapper. You can only lightmap them once they're in the scene (and then the lightmap data is tied to the scene, not the prefab)
     
  3. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    It's not possible currently, but it's been hinted at that you'll one day be able to additively load scenes with the accompanying lightmaps. So... someday... you'll kinda be able to... maybe?
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    That sounds like a sloppy solution. I suppose this feature simply doesn't exist in the workflow for now (no problem) but it would be nice to have some more control over the baking to make things more flexible, not to mention more efficient if you don't need an entire level mapped and could use the same mapping per prefab. On my wishlist for sure.
     
  5. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    You can always create secondary UVs and bake the light in an external program.

    Or better yet - since your prefabs would all have the same baked light, just bake it into the diffuse texture so you only need one texture (unless you reuse or tile the original diffuse texture for various non-identical objects).
     
    Last edited: Dec 31, 2014
  6. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    We've seen the feature request for baking lightmaps per prefab before and we'll see what can be done in 5.x. No promises though, as some settings are inherently tied to a scene and need to be fetched from somewhere when the bake is done just for one prefab.

    Anyway, we hear you. :)

    That said, working with baked data in multiple scenes loaded additively will be our focus fairly soon.
     
    LaneFox likes this.
  7. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    Thanks for the update, and looking into it.