Search Unity

Unity 2019 Terrain Shadows Not Receiving GI

Discussion in 'Global Illumination' started by space928, Feb 17, 2019.

  1. space928

    space928

    Joined:
    Jun 11, 2015
    Posts:
    21
    I've been working on a an outdoor scene in Unity and have stumbled into a problem where shadows cast onto the terrain are not receiving GI (or baked lightmaps). This means that even after baking the lighting, I get pitch black shadows on the terrain:
    Screenshot
    You can see my lightmapping settings from the screenshot and the terrain is marked as static. Am I missing something or is this a bug in Unity 2019?
    Thanks in advance,
    - Thomas
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey! I take it you only have a single directional light in the scene? If so, try changing its type to either baked, and see if the issue reproduces. Also, you could you attach a screenshot of baked lightmap scene view mode as well?

    In addition, to get better defined indirect bounces, it is highly recommended that you'd bump the amount of Indirect Samples.
     
  3. space928

    space928

    Joined:
    Jun 11, 2015
    Posts:
    21
    Thanks for the reply, I tried changing the light type to baked but it didn't seem to make a difference (it had already been on Mixed).When I went into the Baked Lightmap view, I saw nothing, it was just blank (see attachment), but the lightmap did have data in it (also in attachments).
    As far as number of bounces go, I settled on that number since I only needed a very ow quality lightmap to add some ambient light and a bit of occlusion to the trees which it seems to nicely.
    My bodge at the moment has been to modify the HDRP terrain shader (a feat in itself consider how much more complicated shaders have gotten in HDRP) to add an extra sampler for a lightmap and a slider to add the value of the lightmap to the emissive channel.
     

    Attached Files:

  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    From the looks of it, you are using very high light intensities in your scene. It might be so that your tonemapper settings are too aggressive, and thus you are not able to see any indirect bounce on your tree trunks.

    Are your trees marked as static and have proper lightmaps?

    Another way you could inspect your lightmaps is by overriding your albedo color. In HDRP you can do this by navigating to Window > Analysis > Render Pipeline Debug. See the screenshot below:

    T6IUiXuB9g.png
     
  5. space928

    space928

    Joined:
    Jun 11, 2015
    Posts:
    21
    To answer your questions:
    Yes, I am using high light values, though since the project is in HDR, this shouldn't make a difference and for the reasons I am about to explain I don't think it makes a difference.
    I tried to override the albedo, but it turns out this has no effect on terrains (we might need to submit a bug report here).
    But the problem I've been having hasn't been with the trees (which are part of the terrain which is marked lightmap static) but rather the shadows they cast on the terrain. How I want to look (currently achieved using my bodge):
    2019-02-18 (4).png
    And how it looks with the default HDRP terrain material:
    2019-02-18 (5).png
    Thanks for your help,
    - Thomas
     
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    I've just noticed that your scene has almost no sky contribution. Which baking sky method are you using: HDRI or procedural sky? Please make sure that the sky exposure in your Volume Settings is set to a high value to compensate for the bright directional light which you are using.

    Unity_RLjwMRso31.png
     
  7. space928

    space928

    Joined:
    Jun 11, 2015
    Posts:
    21
    Hi,
    Sorry for the late response, I tried your suggestion and set my HDRI baking sky exposure to the same level as the one in scene settings (which has to be high as well due to the overall brightness of the scene), and unfortunately it made no difference.
     
  8. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    In that case, you can either try asking in graphics general sub-forum, or submitting a bug with a small repro project for us to investigate. Thanks!