Search Unity

Question Mixing direct lighting and GI

Discussion in 'High Definition Render Pipeline' started by DanImarK, Feb 18, 2021.

  1. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Hi all,
    Why when I bake my direct light the physically based sky gets black?
    Instead, if I use mixed light I only can see the effect of direct light. I have to override the indirect multiplier value a lot to see the effect of GI mixed with the direct light but then part of the scene becomes overexposed...

    Thank you for your help.
     
  2. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
  3. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Hi, thank you for your reply. This is my setup
     

    Attached Files:

  4. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    The black sky was probably due to some problems with the volume profile in the lighting. I have assigned a new volume, identical for the visual and lighting environment and it seems to work.

    I still get direct light and GI as separate elements. I can only see the effect of direct light. If I override the indirect in my volume giving a value at least of 50 my indirect light comes out. But the white areas get light washed and I loose part of the shadows. The exposure override doesn't affect this issue, so is useless.
     
  5. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, thanks.

    So, there is clearly a problem with the indirect being too weak. You shouldn't have to play with the indirect lighting controller in the volume normally.

    A few things to look into:
    Is the indirect intensity on the light set to a lower value than 1 potentially?
    Did you try to reduce the number of Min Bounces to maybe 5, to see if it impacts the intensity of the indirect lighting?
    Are some important objects that are meant to bounce light off not set to Contribute GI (in the mesh renderer component)?

    If this doesn't help, you might want to report a bug (in Unity > Help > Report a Bug...), with a small repro project. ;)
     
  6. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Do you mean the indirect multiplier? That is equal to 1
    yes, it doesn't get better
    No, unfortunately. I am using HDRP in the 2020.2.3f1 version, but got the same issue with any other previous version. My model is a .max. Could it be something in the materials?
     
  7. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Could be the scale of the model? I see in the inspector that the max units are transformed in unity units by a factor of 100?? 1m file =100m unity.
     
  8. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Yes indeed, the way the light falls off depends entirely on the distance. So this might be the culprit.

    You can override this I think, or simply export your max file as an FBX with the right scaling. You might also notice it's faster to re-import the FBX if you iterate on it, compared to the max file.
     
  9. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Ok, it is strange because in the inspector of my max file in unity there is a scale factor (equal to one), and then the convert units option with a check box for 1m file =100m unity. This last doesn't seem to scale the model physically (as the scale factor I was mentioning would do I assume)...I am a bit confused...
    Maybe I should export the model as fbx from 3d Studio as you suggest.
     
    Last edited: Feb 20, 2021
  10. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    My model in 3d studio is in meter (1 unit=1 meter). I have kept scale=1 and unchecked 1m file=100m unity. The model doesn't change. I think this option is not important if your model in max is 1 unit = 1 meter...

    I have tried importing two boxes of 1 m each from 3D studio. I have unchecked the units converter for just one of the two. They are pretty the same and equal to a unity box of 1m...

    I have read somewhere that by default 3d studio works with centimeter and unity with meter so 1 cm (max) = 100 cm, that is 1m (unity), if so why do we also have a scale factor=1 option...
     
    Last edited: Feb 20, 2021
  11. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    When exporting as FBX, you also need to double-check that the exporter won't mess up the units either. Sometimes the exporter may introduce an unwanted rescaling.
     
  12. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    The thing is that my max model is correctly imported, in the right scale. The unit converter options affects the imported model, I assume, only if your max file is in generic units (with 1 unit equal to x meter/centimeter/...)

    I have tried exporting my model as FBX file and got the same result. I need to override the indirect multiplier to see the baked light.

    Maybe the problem is elsewhere...
     
  13. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    I am using a physically based sky, maybe I should play with miscellaneous options? Would this be considered normal?
     
  14. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    As I said, I can only see the effect of direct light (the sun in my case). If I turn off the light, than the GI appears. There is no way of having them mixed unless one overrides the indirect diffuse light multiplier.
     
  15. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Importing the model as obj and playing with the metallic (0.13) and smoothness (0) options of the material, the Gi comes out. Keeping the metallic low makes the textures look like if they are covered in dust, but at least you can see the lighmaps. The more metallic the less the lightmaps show.
    A combination of 0.5 metallic, very low smoothness and a little override (10) of the indirect multiplier in the volume, is making the GI evident enough, but is this the 'right' way of handling it?
     
    Last edited: Feb 21, 2021
  16. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, did you place any reflection probes? if not, this could explain some of the issues.

    There should be no need to hack the metallic to get correct results. Maybe have a look at the latest HDRP template available in 2020.2, just to make sure your volume/light/reflection/exposure setup is correct. Or simply import your model in it, and bake it there (it'll still need some reflection probes to be added, depending on its size and if it has any "interiors").
     
  17. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Mmm actually no, no reflection probes in my scene.
    I have exteriors (a courtyard) and interiors.
    I will try adding the probe as you suggest. Thank you!
     
  18. DanImarK

    DanImarK

    Joined:
    Dec 1, 2019
    Posts:
    22
    Ok, it seems to work. I have placed many probes and I see that between one and the other there are some overlapping areas that not render perfectly (still getting a sort of dusty effect), but I am new to reflection probes...
    So I have placed just a big one including all the model, now it renders good but maybe this is not the correct use of the probes? One should place a probe per room/area?
     
    Last edited: Feb 21, 2021
  19. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    I'd recommend to look at the HDRP template in Unity 2020.2 to see how reflection probes can be placed. The number of Reflection Probes you place will depend on the quality you're after and the type of materials you use. If you have glossy ones, you may require more reflection probes.