Search Unity

Question Point light NO baked shadows

Discussion in 'Global Illumination' started by tanmaykulkarni, Mar 31, 2022.

  1. tanmaykulkarni

    tanmaykulkarni

    Joined:
    Nov 5, 2019
    Posts:
    104
    Hii devs,
    I am trying to bake GI for my scene which consists of 4 point lights, mode set to mixed, Render mode set to important, shadow type set to Hard Shadows.

    The model's mesh renderer settings are set properly to contribute GI and I've also ticked the generate lightmap UVs in the model importer.

    I am baking using the Shadowmask Mode.

    When I bake lighting, there are no baked shadows when I am in Shadowmask Mode, and the quality of the scene lighting is affected badly after bake.

    Before Bake:
    Screenshot (91).png

    After Bake:
    Screenshot (92).png

    See there are no shadows baked from the rod.

    Also, I am using URP in my project.

    Is there a solution for this? Is there a problem with the model?
    Pls help
     
  2. tanmaykulkarni

    tanmaykulkarni

    Joined:
    Nov 5, 2019
    Posts:
    104
    UPDATE*
    I tried changing the point lights with spot, and directional lights, but still, there are no baked shadows at all. All other scenes in my project have baked shadows, only this scene has some bug.

    Also tried replacing the lighting settings asset with a new one... Still, the problem persists.

    Why is this happening? Anyone?
     
  3. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Some additional info is needed to figure out what's what. Could you please post:
    • Screenshot of the lighting settings used
    • How does the Baked Lightmap scene view draw mode look like?
    • How does the GI Contributors scene view draw mode look like?
     
  4. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Baked lighting looks different than the realtime pic. It feels like the light is coming from a different place.
    Make sure this isn't a UV issue, and try to test with 1 light at the top. And check on all meshes that they receive/contribute GI and are static
     
  5. tanmaykulkarni

    tanmaykulkarni

    Joined:
    Nov 5, 2019
    Posts:
    104
    Sure, here's the screenshot of:
    Lighting settings-
    Screenshot (95).png

    Baked GI Scene View-
    Screenshot (93).png

    GI Contributors scene view:
    Screenshot (94).png
     
  6. tanmaykulkarni

    tanmaykulkarni

    Joined:
    Nov 5, 2019
    Posts:
    104
    Yeah I know it looks different, but all the scenes that have baked lighting in my project have good quality baked shadows. Only this is the scene where the shadows disappear after bake.

    I tried using one light, and all my meshes that contribute GI are marked static.
     
  7. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Judging from the Baked Lightmap view, baked indirect shadows are indeed there. However, I can see some issues with your current scene setup:
    • Your lightmap UVs contain a lot of distortion. You can see how stretched some of the texels are. Author lightmap UVs yourself, or have Unity generate them for you in the mesh importer settings
    • Some of the meshes have very low lightmap resolution. Again, just look at the texels. Baked shadows will have almost no definition on such meshes
    • Why are you mixed lights with the Subtractive lighting mode? Only directional lights will provide realtime specular response. Other punctual lights (spot, point, etc.) will be treated as baked lights. If you want to take full advantage from mixed lights, please use either Baked Indirect or Shadowmask lighting mode. You can read more about it here: https://docs.unity3d.com/Manual/lighting-mode.html
    I would strongly recommend reading the manual, and watching some videos on the subject of lightmapping. Here's a good video to start with:
     
    r9shackleford likes this.
  8. tanmaykulkarni

    tanmaykulkarni

    Joined:
    Nov 5, 2019
    Posts:
    104
    Yeah, I have enabled Generate Lightmap UVs option in mesh importer settings. Also, I've tried increasing the 'scale in lightmap' and baking the scene in Shadowmask mode.
    Still I am unable to see baked shadows...
     
  9. tanmaykulkarni

    tanmaykulkarni

    Joined:
    Nov 5, 2019
    Posts:
    104
    UPDATE*
    I tried baking my scene at 200 Texels per unit and all other highest lightmap settings. Now I got to see some shadows but they are way too stretched and blurry. There seems a problem with the model or uvs. Here's the screenshot of how the shadows are looking:
    Screenshot (98).png

    Is there a way to fix this? I cannot increase the resolution anymore as the lightmaps are occupying a large amount of space at these high settings...
     
  10. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Each square you see in the lightmap view represents exactly one texel in the resulting lightmap:



    The entire texel will either be in shadow or not, it cannot represent details smaller than itself. So you need to increase the resolution and preferably also reduce the distortion in the loghtmap UVs.
     
  11. tanmaykulkarni

    tanmaykulkarni

    Joined:
    Nov 5, 2019
    Posts:
    104
    Bro the mesh renderer is already set to the highest scale in lightmap and I am baking such a small scene at 200 texels per unit.


    How can I do that?