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

Realtime GI passes through walls

Discussion in 'Global Illumination' started by rstorm000, Sep 24, 2015.

  1. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    So scoping out the real time GI stuff and it seems inconsistent when you want to make rooms actually dark. I set up this experiment with 2 rooms next to each other with no openings anywhere. If you put a light in the room on the left (shadows are turned on), it will light the inside of the room, but then the light also passes out of the room and into the room next to it. Here is the set up:


    Inside the box on the left:

    Inside the box on the right, with light leaking in(!):

    So you can see the light both on the outside of the boxes as well as inside.

    Here is what it looks like with baked light only, which turns out as one would expect:

    How can we prevent this from happening? (Note the inside and outside of the boxes have no connected verts and the box on the right is even separate objects between the inside and out)
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,248
    Look at your own first screenshot, read the warning text on the right.
     
    CarinaMclane likes this.
  3. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Well yup, that would explain it. Does this make it impossible to have a dark room next to a light room with the real time GI? The room on the right does indeed turn black when the bounce intensity is turned to zero. Also bounced light seems completely unaffected by culling settings.
     
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,996
    Use emissive surfaces instead of lights.
     
  5. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Do you have an example of what you mean here
     
  6. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,657
    The Standard Shader Material has an Emissive entry in it. Create a Plane or Cube, apply a new Material to it and tweak the Emissive value as you wish. There you go: an emissive surface :) You could probably use an Area Light, though...
     
  7. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Yeah, because I was also experimenting with making the walls themselves emissive.

    Emmisive materials are having strange behavior. It seems to work in the editor Scene view in real time, but when going into play mode, editing the brightness or color does not change the real time GI.
    http://gfycat.com/DazzlingSpanishFlounder


    Light probes were also behaving strangely as well.
     
  8. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Okay never mind, it appears you have to use the DynamicGI.SetEmissive(renderer,Color.white); function like so. I don't know why this is so unintuitive, but works! That said, is there a way to reduce the fade time on the GI to be more snappy
     
    Last edited: Sep 24, 2015
  9. CarinaMclane

    CarinaMclane

    Joined:
    Mar 12, 2014
    Posts:
    23
    The 'fade' time I would assume is dependent on how long it takes the light to propagate through the precomputed links. Guessing it's directly dependent on your GI complexity / resolution.
     
  10. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Also emissive shader thing works slightly better but I'm still experiencing a lot of bleeding into other rooms if the walls are close by:



    I would imagine this is dependent on the realtime gi resolution? but not sure. Does anybody light scenes well only with emissive surfaces?
     
  11. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Okay it seems better at 30 resolution, but still not great...



    Also I imagine baking at 30 resolution will be rather difficult for large scenes. This is just two boxes next to each other.
     
  12. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,996
    Seal your room from the outside and give your walls thickness.
     
  13. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Here the rooms are fully enclosed with thickness and separation and the light still bleeds through plenty

     
  14. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Also, for goodness sake I'm get light bleeding on a just statically baked lightmap with 1 light bounce and a point light and a 1 foot thick wall at 30 res
     
    Sungold likes this.
  15. Sungold

    Sungold

    Joined:
    Jan 13, 2013
    Posts:
    9
    Old thread, but I've been experiencing the same bleeding for all of my static geometry, even if they are within the same mesh. I'll try out the ideas in this thread. (BTW I love intruder so much, thanks Mr. Storm!)
     
  16. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,996
    if you have GPU to spare, try out SEGI, no leak, no bake or enlighten funny business.
     
  17. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    I try to avoid using a single cube for a room. Instead, import a model which has the walls, floor, ceiling all as separate meshes. There's too many issues that happen when you try to treat all of these as a single cube: from GI issues to OC issues.
    Also, if you add a lightmap static plane between the two cubes, it should block all GI flowing between the two cubes.
     
  18. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    Hi, i'm having similar light leak issues (with directional), did anyone find any solution to this problem?

    directional_light.JPG
     
  19. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793

    Merge roof and wall vertexes together to fix completely this issue.
    Maya: Mesh Tools->Merge
     
    Last edited: Jun 12, 2017
  20. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
  21. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    I use SketchUp and 'merged' walls and columns as you suggested but encountered another problem. When i save SkethcUp file, my model reimports automatically (auto-refresh) in Unity but it doesn't appear or replace inside 'viewport' (it was working fine before when i add new objects).

    Images below shows old walls (duvar) & columns (kolon) still appear (see their axes) in the hierarchy somehow (they no more exist in SketchUp). And new 'merged_wall' mesh is imported and be seen in assets but not in viewport. Why is this happening?

    previous_walls_and_columns.JPG
    merged_wall_not_appears_in_viewport.JPG
     
  22. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    Drag again your model into scene from project files
     
  23. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    Thank you Ali for your help, i did as you explained but result is literally same as before.

    merged_floors_walls.JPG
     
  24. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    Your roof geometry is completely separated from your wall. you should create more edges and points between roof and wall connections and then merge those connected vertexes.
    A simple way to do this is boolean(Union) operation in max or maya in between wall and roof.

    merged_floors_walls.JPG
     
  25. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    I think you misunderstood me because of the previous example i show. I was just testing quickly with walls to see how it goes. So, in the end i merged everything including floors, ceiling and walls. (I left the 'merged_walls' name not to break the links for now to avoid 'redragging'.)
    ---
    Edit: How can i share Unity project?
    Here is the .skp file if you want to download and have a look: https://3dwarehouse.sketchup.com/model/c79460c3-4a3e-4090-9b7b-bbc2c9ab1c21 (version 2015 is compatible with Unity)
     
    Last edited: Jun 14, 2017
  26. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    Yes I'm sorry that was wrong

    here is difference between resolution 2 and 10:
    Untitled.jpg
     
  27. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    Here is my difference between indirect resolution 2 and 10. Considering amount of time required for baking higher resolution, the result is not satisfying, is it? Also it's quite weird that while some of the leak has gone, new leaks are produced.

    res_2.JPG
    res_10.JPG
     
  28. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    No
    Create a new lightmap parameter file and set its Resolution to 10
    I already tested all settings. Only resolution affected to this issue
     
    pachermann likes this.
  29. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    Allright, i've made a new lightmap parameter and increased the resolution under Precomputed Realtime GI, here is the result with 6 res. (10 res. is unbearably slow even with this empty room and gives this error: "Failed executing external process for 'Clustering' job.")

    res_6_parameters.JPG
    As you can see even though leak is reduced, on top of left wall new leak appears. I'm really going to conclude that this is a bug with Enlighten, because there is no solution in either forums or 'answers' section...
     
  30. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    Send me your model to find a solution if it exist
     
  31. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    I've shared the SketchUp model in post #25 (info is there as well). It can be downloaded from that site.
     
    UnityLighting likes this.
  32. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    Same problem after 3 hours baking
    Untitled.jpg

    also your model has been combined into one chunks. More chunks has higher lightmap uv space and resolution.
    Slice your model into more chunks and test again.
    21.jpg
     
    Last edited: Jun 15, 2017
  33. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    progressive lightmapper in chunked model with different resolutions:



    T1.jpg T2.jpg t3.jpg
     
  34. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    Another solution
    1. Create two lightmap parameters. one with low res and another with high res
    2. Assign low res as scene parameters and assign high res one to walls and floor geometry in mesh renderer

    result is very faster bake :
    3.jpg
     
  35. filibis

    filibis

    Joined:
    Apr 3, 2017
    Posts:
    35
    I got a reply to my bug report today as seen below. And I managed to solved the problem by using Progressive Lightmapper (preview) with 0 backface tolerance (result also below).
    Thank you for your effort Ali!

    bug_reply.JPG progressive_backface_tol_0.JPG
     
    pachermann likes this.
  36. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    I thought you wanted real-time. For baked, PLM is best choice. The problem was from low Resolution and with PLM you can bake with very high resolutions.
    Also your problem will not be fixed with 0 BakceFace Tolerance. You should be use default settings with higher resolution.

    Also backface problem has been fixed in 5.6.1patch4 and 2017.1beta9
     
    Last edited: Jun 19, 2017
    scvnathan and filibis like this.