Search Unity

Light / Lightmapped Object Question: How does the light know it's lightmapped.

Discussion in 'Global Illumination' started by SuperUltraHyper, Aug 2, 2018.

  1. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    86
    A) In a scene with a lightmapped object but the lightmaps are not baked unity will light the object with real time lights.

    B) Once the light maps are calculated it will render the object using the baked light maps.

    Question) How does the light know not to real-time light the object once light maps are calculated?

    Scenario) At run-time I am instantiating the meshes and manually setting up the light maps (UV coord offset and the lightmap itself.) But the mixed mode light is still applying real time lighting to the object.

    For my uses case, Layers / Culling Masks are not a great solution for various reasons. Ex. The Mixed Mode Light will not cast a dynamic shadow onto the lightmapped mesh.

    Thanks in advance!
     
    Last edited: Aug 2, 2018
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,439
  3. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    86
    I understand how mixed mode works.

    What I am asking is:

    If I assign the lightmap manually through script, how can I tell the light that the geometry is lightmapped, and therefore DOES NOT need to light the object but DOES need to apply a real time shadow to the object.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,439
    I’m guessing Unity sets the LIGHTMAP_ON keyword for those materials.
     
unityunity