Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved No shadows appearing with Baked Lighting

Discussion in 'Global Illumination' started by transgwenderproud, Mar 2, 2021.

  1. transgwenderproud

    transgwenderproud

    Joined:
    May 25, 2020
    Posts:
    10
    Hi there. I've been trying to improve my game's speed by creating a baked lightmap. However, I keep running into the issue that no matter how much settings I adjust, my level is always a constant no-shadow scene.

    upload_2021-3-1_23-34-44.png

    This is how it currently looks, as you can see, no shadows anywhere. However, If I flip the debug camera to Baked Lightmap
    upload_2021-3-1_23-35-28.png

    All the shadows are baked in properly. I can't figure out why the baked lightmap has the shadows properly rendered while the main scene isn't.

    Light settings:
    upload_2021-3-1_23-38-24.png

    Light Baking Settings:

    upload_2021-3-1_23-37-11.png
    upload_2021-3-1_23-37-27.png


    My version is 2019.4.17f. All my tree models have a custom Lightmap UV.
     
  2. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    250
    Hey there,

    Which kind of shader are you using on the materials for the scene objects in that image, are they just using standard?

    Could you perhaps post a screenshot of the inspector for one your scene objects?

    I'm not sure how big your project is, but a repro project with that scene would be helpful. :)

    Cheers
     
  3. transgwenderproud

    transgwenderproud

    Joined:
    May 25, 2020
    Posts:
    10
    All the objects are using standard shading, and the inspector of one of our trees is:

    upload_2021-3-2_9-44-34.png upload_2021-3-2_9-45-3.png

    The project is too large and composed of too many scripts to share just the scene in question immediately. The repo we are using is currently private.
     
  4. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    250
    Hmm, I don't see anything obviously wrong in your setup.

    Could you try opening the frame debugger (Window > Analysis > Frame Debugger), locate some of the draw calls for your scene objects, and ensure that the LIGHTMAP_ON keyword is present, and that the lightmaps are being fed in as expected. https://i.imgur.com/NXLCgUQ.png

    Additionally, if you are using GPU Instancing for any materials, try turning it off.
     
  5. transgwenderproud

    transgwenderproud

    Joined:
    May 25, 2020
    Posts:
    10
    All the objects that should have a lightmap has the keyword, and it all appears to be fed in properly? No material is using GPU Instancing either.

    In the Frame Debugger: One of the trees
    upload_2021-3-3_14-26-57.png

    And one of the tiles
    upload_2021-3-3_14-27-13.png
     
  6. transgwenderproud

    transgwenderproud

    Joined:
    May 25, 2020
    Posts:
    10
    To whoever it was that suggested changing the Baked Shadow Angle, thanks for letting me know about that detail, and while baking it with a value of 0.5 gave me a better Baked Lightmap view illumination:

    upload_2021-3-3_14-49-44.png

    It unfortunately didn't change anything in the actual shaded view. Still no shadows display in Shaded view:

    upload_2021-3-3_14-50-43.png

    Edit: I also just built and tested the project, just to see if it might be a editor issue. There is no shadows there either.
     
    Last edited: Mar 3, 2021
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,011
    Hi yeah, it was me, I deleted the post because I misinterpreted what the actual problem was.

    Now that I have read the problem: Can you try removing that metallic map and making sure that metallic is set to 0 and see if that changes anything?
     
  8. transgwenderproud

    transgwenderproud

    Joined:
    May 25, 2020
    Posts:
    10
    Bingo! The instant I removed the metallic map from the objects, did the shadows finally get rendered!

    upload_2021-3-3_15-2-42.png

    Just for future reference, do you know why the metallic map caused that? I appreciate the help ahah. Now that it actually displays properly, my team can actually get some good lighting!
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,011
    That wasn't really a metallic map, not sure why it was plugged in the metallic slot, but more generally:

    Metallic materials only show reflections and don't really show diffuse lighting all that much (lightmaps in your case), so having set your materials as highly metallic (by plugging in the wrong map) there was no diffuse lighting / lightmaps shown.
     
    bugra876 and transgwenderproud like this.
  10. transgwenderproud

    transgwenderproud

    Joined:
    May 25, 2020
    Posts:
    10
    Ah okay, that makes sense. Thank you so much for the help, and the lesson ahahah. Appreciate it.
     
    AcidArrow likes this.