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. Dismiss Notice

Progressive CPU baking problem

Discussion in 'Global Illumination' started by KudeweGames, Jan 31, 2020.

  1. KudeweGames

    KudeweGames

    Joined:
    Jun 24, 2018
    Posts:
    2
    Hi, I have trouble making cooking lighting look more like real-time, I would like to know if there is a way to make the cooking result more true to real time. I attach photos of settings and difference images. Thank you.(Unity 2018.3.0f2)
    Screenshot_1.png Light.png Settings.png
     

    Attached Files:

    Last edited: Feb 1, 2020
  2. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    99
    I see two major problems in the baked versions: Seams and unexpected dark areas.

    The seam issue (hard edges where no hard edges are expected) happens because baking/lightmapping involves "unwrapping" your geometry into a flat UV space. In this process Unity may have to split a single object into separate charts/islands. These charts/islands can be seen in the final lightmap. To solve this issue you need to make sure you have enabled lightmap seam stitching and that you have set Hard Angle sufficiently high inside the Mesh Importer (assuming you are using Unity to generate your UV layout). The default value of 88 should be fine.

    The other issue where some materials/surfaces look dark is a bit more difficult to reason about for me. It seems like the baking system "sees" these material as black, and there no light bounces off of them. The reason for this can be malfunctioning meta pass but that is hard to say without more information.
     
  3. marcosbiagi

    marcosbiagi

    Joined:
    Mar 22, 2019
    Posts:
    6
    Hey! Thanks for answering. I'm working on this same project.

    Question: If the UVs were carefully made in 3DS Max (and then packed into atlases), should we still use the "Generate Lightmap UV" option for our models?

    Is this advised for all situations?

    I will try your suggestions, although I already experimented with those settings without great results. How can we provide additional information to resolve this issue?
     
    Last edited: Feb 6, 2020
    KudeweGames likes this.
  4. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    99
    Unfortunately, Unity currently does not provide a silver-bullet solution to this problem. There are pros and cons with both approaches:
    1. You can provide UVs generated from 3DS Max. Then you should disable "Generate Lightmap UVs" in Unity. However, if you do this, it is your responsibility that the distances between charts (in UV space) are sufficiently wide so that no texel bleeding will happen (information from one chart leaking into another). This is trickier than it sounds, unfortunately. The sufficient distance between charts depends on several things. For example how many texels are allotted to the object in the final lightmap. The number of allotted texels depends on the object's scale and various project settings. Note this also means that the requirement to a "good" UV packing for an object changes if for example you scale up the object (because then it gets more texels allocated by Unity). In practice, people often just guess a UV chart margin/padding, and then increase it and try again if was not large enough. This is a horrible workflow :(.
    2. You can use Unity's automatic UV generation. The problem with this is that it is not as good as what you have in 3DS Max in terms of efficiently using the available UV space. Additionally, you still have the problem mentioned above where you may find yourself repeatedly tweaking the packing margin as you change your scene (object scale, lightmap parameters). This can be annoying as well. Unity 2020.1 will include a new setting called "Min Lightmap Resolution" (in Model Importer) that helps with this problem. You basically give Unity a "guarantee" about the conditions with which you intend to use your object. In return, Unity provides you with "good" UVs (i.e. no texel bleeding).
    You can read more about lightmap texel bleeding in the docs.

    You can try to inspect the scene via the "Baked GI > Albedo" debug visualization. This shows you how the lightmapper "sees" your scene. If the color is black/dark where you did not intended it, that may be the reason of the darkning.
     
    Last edited: Feb 10, 2020
    KudeweGames likes this.
  5. KudeweGames

    KudeweGames

    Joined:
    Jun 24, 2018
    Posts:
    2
    Well, also after several attempts we get something relatively similar to what we wanted, we will keep trying, thank you very much for your attention!
    The black objects were due to the fact that the light probes were placed incorrectly. There was also a lot of difference due to the resolution of the light map, unfortunately I couldn't do something good even by touching all the Generate UV values, so we turned it off.
    PD: sorry for my English.