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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Does Light baking need an update?

Discussion in 'Global Illumination' started by McDev02, Feb 27, 2018.

  1. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    We all know the issue of light bleeding and I made a bit of research today as I couldn't find a solution to my issue.
    Note: Update in post below. It is not related to lightmap resolution.

    render settings.jpg

    I want to know if I am right or wrong, so it all is based on my own assumptions. Also if a Unity / Light technician could jump in that would be great.

    From my view this is a similar issue as we see with light probes. As I placed light probes in indoor levels it was a real pain as the correct way would be to split light probes between two rooms for instance so that they don't share lighting information. Maybe this is for performance reasons or it is even possible but not with default tools. So the only solution was to make a big amount of probes around the walls to at least minimize the effect.

    The issue I face is thin walls that bleed lighting and I messed around with any single lightmap parameter to find out that it is solely depended on indirect resolution. I found out that I need an indirect texel size of at least the size of my thinnest wall to get rid of this effect. This would for a 1cm wall be an indirect resolution of 10 (1 / 0.1) and even then I get slight issues.

    The problem is that apart from that I am just fine with a small indirect resolution as I only need rough light bounces from wall to wall. Some areas work and others don't so I find it unpleasant that I have to increase resolution only for those artifacts.

    What I wonder is if there would be alternative ways like to increase resolution only on such areas or where objects meet but let the other areas be low res. Basically we would have min and max values for indirect resolution.
    Another solution might be to explicitly say that this object is a wall or is important for GUI so that the algorithm knows here it has to look closer or whatever.

    Maybe I understand this for Realtime lighting but it should not happen for Baked Lighting as I think we have more opportunitions e.g. like uneven resolutions.

    Those are just my two cents as I think that for this specific use case increasing indirect resolution isn't the ideal solution. For city environments this can even be really depressing where I only need indirect resolutions of 1 or 2 for buildings and streets but maybe on just a few spots I would need 4 or 8.
     
    Last edited: Feb 28, 2018
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,982
    You can fix it (or work around it I guess) by making your own lightmap UVs and introducing seams at points where the lighting will change dramatically because of a thin wall.
     
  3. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    It is not related to lightmap resolution.

    When I look at the image once again I think I understand now what is going on. I already wondered what Indirect resolution does or where the checkerboard comes from. It is a lightmap on it's own, right? Actually now anything starts to make more sense. The problem seems still to be that we can not adjust this resolution per object. Also, how is that even calculated, it does not seem to be generated from Lightmap UVs.
    indirect texel.jpg

    I think it was explained somewhere in this talk but I might have to watch it again.

    Wouldn't it be possible to expose an indirect resolution scale to each object just like Scale in Lightmap?

    Its just that it is a bit bad that where objects are placed affects how the result will look like. So here you can see it could be solved by placing the wall exactly on where the texel change so inside the middel of the texel. Of course this is an exaggerated example.
    texel2.jpg

    Well we just need Octane Lightmapping I guess, that stuff doesn't happen with a raytracer.
     
    Last edited: Feb 28, 2018
  4. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    I want to add that actually Resolution in Lightmap Parameters does affect Indirect Resolution as I first thougt. There just is missleading termonology as it refferes to "Realtime resolution" which actually means indirect resolution. Yet this isn't a great workflow, if that can be done on a per object basis it would be great.
     
  5. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,886
    If you can get your clusters to line up, it should have a clean edge there:
    1.PNG 2.PNG 3.PNG

    That last wall is 0.03125 wide. You can see that it doesn't bleed through, even at indirect resolution 2.

    Here it is when moved "off-grid" inside a cluster:
    4.PNG 5.PNG

    Mesh Renderer > Lightmap Static > Scale on Lightmap doesn't seem to affect it's indirect resolution for me, so maybe you can't adjust clustering/etc per object.
     
    Last edited: Feb 28, 2018
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,982
    I'm unclear. Are you using Enlighten or the progressive lightmapper? (and if you're using Enlighten, are you using realtime or baked lighting?)
     
    Last edited: Mar 1, 2018
  7. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    Enlighten of course. Progressive has no clustering or indirect lightmaps.

    I believe it rather relates to indirect resolution. Here the clusters are cut and as any of those are independent so it should be fine, except for the corners maybe. If the edge is in the middle of a texel (balck line) then it is fine, it makes sense as each texel is one pixel of the indirect lightmap.
    clustering.jpg clustering2.jpg

    Yes, this is why I wonder if it would make sense to add such an option.
     
    Last edited: Mar 1, 2018
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,982
    You can do that with enlighten, although with a different method. Create a bunch of Lightmap Parameters, set different resolution settings for each one (or whatever else you want), and then set them to each mesh as you wish.
     
    Stardog likes this.
  9. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    I can not simply switch from low to high for instance without editing each setting itself. Not a big deal if we just talk about a few settings but just not ideal.

    After all that post helped me to understand things better and maybe it helps others as well in the future.
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,982
    It's not exactly like that because each resolution setting in lightmap parameters is relative to the global (it gets multiplied with the global setting, that's why by default it's 1).
     
  11. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    I am talking about all the other settings so lightmap parameters in particular. I am used to start with VeryLow for preview and use Medium for final bakes. But you are right that it is at least a solution.

    Also just for addition spliting the mesh is of course a solution but only for encapsulated areas like the ceiling or floor of rooms. But for floating geometry like here where only parts are occluded by a wall this won't work out.
    split wall.jpg
     
  12. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,788
    Always place a grid of the small light probes into your whole scene. Forget about optimization. Light probes are optimized even on low end devices

    1. Forget planes on modeling. Always use Thin cubes as walls and floor (or windows glass)
    2. Select your important object from the scene and increase lightmap scale for target model
    This problem is only related to Resolution
    For example 10for global resolution and Lightmap Scale 10 (10X = 100 )for target object)
    The best solution is the separating the exterior and interior scenes (levels)
    Realtime GI for exterior and Baked for interior