Search Unity

Baking lighting for two objects that occupy the same space

Discussion in 'Global Illumination' started by dgoyette, Jan 13, 2020.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    I have a perhaps odd/unique use case. I have some "breakable" objects in my game, such as a wall that can break to expose the insides of the wall. Here's the wall when it's broken, and you can see the chunks left behind:

    upload_2020-1-13_15-57-46.png

    Before the wall breaks, it's just a single object, basically a cube. After it breaks, that cube is swapped out for the more complex model. This is for performance reasons: Until the wall is broken, it's better not to have the complex object rendering unnecessarily.

    The problem I'm having is that I want both the Whole and Broken models to have baked lighting on them, otherwise it looks really weird to swap one object for the other. If both models are rendered while I bake, then the Whole version blocks light from getting into the broken parts.

    Is there some way to have two renderers receive baked lighting, but without affecting one another? I thought I could set the LightmapParameters for the Whole object to use "Transparent", but it seems that only works for Realtime GI, not baked lighting.
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    dgoyette likes this.
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Thanks. But if I bake the lighting in a separate scene, wouldn't that separate scene need all the same lighting setup as the original scene? So, this is a possible solution, but it would require duplicating either the entire scene, or duplicating the portion of the scene that would have an impact on the baked lighting?