Search Unity

I have a problem with my Baked Global Illumination

Discussion in 'Global Illumination' started by Hyp3ri0nn, Jul 24, 2017.

  1. Hyp3ri0nn

    Hyp3ri0nn

    Joined:
    Jul 4, 2017
    Posts:
    1
    I have modeled a villa interior with 3DS Max, but when i imported to Unity as FBX, i am getting some issue about lighting if anyone got this situation before pls help me (sorry for my english)
     
  2. Amitgp

    Amitgp

    Joined:
    Aug 18, 2014
    Posts:
    22
    Hey

    This is called Light bleeding and happens for many different reasons.
    Some reasons from the top of my memory are:

    1. Not having UV maps or correct UV maps for lighting. As you need a second uv channel for baking lights.
    2. Intersecting or gaps in geometry
    3. Same UV on the whole building, rather than separating floor, wall and roof.
    4. Light settings such as resolution is too low, this is often related to the scale of the object being less than 1 Unity Unity = 1 Meter. So the shadow, texel and everything isn't being calculated correctly.
    5. Whne you generate the lightmap, you have to make sure during fbx import that you have hard angle at 60, pack margin at 16, angle error at 1, area error at 1. This will help create gaps in the UV.
    6. Having overlapping UV, but that tends to create black spots rather than light bleeding.

    This is all I remember, please review them and search for more information with that information.

    If you don't want to figure out the real problem, my guess its the intersection based on what I see on the image itself alone.

    That said, when I do lighting for other people I don't have time to fix it so I add a second plan behind, under or where I need it to block the light thus removing the light bleeding. You can hide the mesh, still cast the shadow and what not also these days.

    Best of luck!
     
    UnityLighting likes this.
  3. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Just increase model scale or lightmap resolution. Always use Progressive Lightmapper for baking.
     
  4. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hi @Hyp3ri0nn,

    Not sure which baking backend you're using but regardless of which one you use, padding between UV charts (islands) need to be at least 2 full texels apart. Otherwise you'll continue to see light bleeding. You can use Object Maps tab under the Lighting window and select baked intensity to see the layout of your UV. You can also use baked lightmap visualization mode.

    And as @Amitgp mentioned, you need correct UV layout for baked lightmaps. UV1 channel in shader code is used for baked lightmap and UV0 is used for albedo, metal/spec etc (details are available here: https://forum.unity3d.com/threads/important-information-regarding-mesh-uv-channels.370746/). In Maya, there is UV Set editor that allows you to see the order. Unfortunately, I don't know what is the equivalent of that in 3DS Max.

    In Enlighten, it may be harder to eliminate these artifacts. In Progressive Lightmapper, it should be more intuitive. Thanks
     
  5. Amitgp

    Amitgp

    Joined:
    Aug 18, 2014
    Posts:
    22

    Could you confirm what @aliyeredon2 said about scaling the object? I was told previously that scaling is same as increasing the quality in lighting setting? Correct? No?
     
  6. Amitgp

    Amitgp

    Joined:
    Aug 18, 2014
    Posts:
    22
    I don't recommend using that as solution at all, if it works it is just a quick fix but it will also increase baking time in my experience. In general, solving it properly like I suggested and @kemalakay will be better in the long run. If he ends up with a bigger scene, and long build times he will get into other challenges just because he scaled the model or increase lightmap resolution when the problem might be uv charts, mapping, layout or something of that sort.
     
  7. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Yes.
    Scene scale should be according to unity Cube (1x1 meter) . Also smaller models has better rigidbody and car controller behavior
     
  8. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @Amitgp

    Yeah, I mean usually you should just decide what units you're using when you start a project and stick to it even though Unity still doesn't provide any proper metrics to measure against yet (WIP). Until then, what @aliyeredon2 suggests is true: just use default cube primitive as a reference (1x1 meter).

    And yes, I don't recommend just scaling things up. It is true that you can increase cluster resolution and achieve higher quality simply by scaling up but by no means you've full control over that, it is rather a workaround solution. Instead, increase quality settings in Lighting window or assign a custom lightmap parameter to adjust lighting settings locally, per object. That's the suggested approach.

    Thanks