Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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:
    112
    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:
    11,631
  3. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    112
    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:
    11,631
    I’m guessing Unity sets the LIGHTMAP_ON keyword for those materials.