Search Unity

First bake, all is okay EXCEPT for my custom model (with UV Lightmap) :(

Discussion in 'Global Illumination' started by Tset_Tsyung, Oct 7, 2018.

  1. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Hey all,

    Long story short, I'm experimenting with VR whilst I have my frineds Oculus. Making a simply scene, want it to look at least slightly decent.

    I'm using a custom table with table cloth that I made in Blender quickly.

    The bake is causing the individual squares (cells?) on the table look awful! Here's some screen shots.

    This is how the table looks with the light baked (done twice, once with and once without the cloth):
    LightmapTables.PNG

    Here's my Unity Bake and Mesh Import settings:

    LightmapSettings.PNG

    Here's my TableCloth's UV map and Lightmap from Blender:
    LIghtmapBlender1.PNG


    And finally, here's my Table's UV Map and Lightmap from Blender:
    LIghtmapBlender2.PNG

    I will gladly provide more screeshots and infor as requested. If anyone has any ideas why this is happening I'd be greatly appreciative!

    Laters,

    Mike
     
  2. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    Do you have any parts of the UV that overlap with each other. That’s what that looks like. In the import settings of the model there is a “generate light map uv” checkbox, try that.
     
    Tset_Tsyung likes this.
  3. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    @newjerseyrunner m

    Hi, many thanks for the reply.

    No, there's no overlap. In the blender screencaps the bottom image in each is the lightmap - there's no overlap.

    I have tried having Unity generate it's own lightmaps as well. I've just run it again, here's the results - they are only marginally better:
    GenerateLightmapsResult.PNG

    Any clue?

    Again, many thanks.

    Mike
     
  4. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Okay, still no luck, but here's what I just tried.

    So I was wondering if it was something to do with having 2 UV's from Blender, So I removed the UV map and set the lightmap (with separated cells) as both the UV and Lightmap UV. Still no good when generating or importing UV lightmaps into Unity.

    So instead I combinged both the table AND the table cloth into a single object in case Unity didn't like having them both imported at the same time (didn't think it would be that, but just being thorough). Still no luck when Importing or Generating UV Lightmaps.

    Here's a screenshot of the combined object UV/Lightmap...
    CombinedObjectUV.PNG

    ... and the result:
    CombinedObjectResult.PNG

    Man, this is driving me crazy!!!

    P.S. I feel that I should state that I'm using 2018.2.11.f1
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    This looks to like you don't have enough resolution. Do the results improve if you use higher resolution?
     
    Tset_Tsyung likes this.
  6. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Hi @AcidArrow , thanks for helping out.

    Okay, I tried increasing the resolution of the following:
    1) The Lightmap Unpack settings - I increased the image size from 512 to 4096. I also increased the padding to 0.85:
    NewUnwrapSettings.PNG

    2) I increased the size of the UV map itself to 4096 as well as I wasn't sure which setting would override which.
    NewUnwrapSettings2.PNG

    The results weren't great:
    Results1.PNG

    So I increased the 'Progressive Lightmapper' resolution settings as well. The Indirect resolution is now 8, the lightmap resolution is now 50, the lightmap padding is 4 and the lightmap size has been increased from 512 to 4096:
    Results2.PNG

    And yet the result are still, although a LOT better, not great...
    Results3.PNG

    Again, thanks for the assistance. Can you think of anything that I'm missing?

    Mike

    Update:
    Have just told Unity to generate it's own Lightmaps for this item and the results came out better, but still with visible problems... Screenshot to follow
     
    Last edited: Oct 7, 2018
  7. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Even when telling Unity to create it's own UV lightmaps for the table and cloth these higher resolutions still have visible issues...
    Stillproblems.PNG
     
  8. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi,
    My first question is if you really need both realtime GI and baked GI. I would suggest just turning off the realtime GI and then you don't have to worry about indirect resolution.
    Then 50 is a bit high, check with 40 and then please attach the lightmaps in the thread so I can have a look why the bleeding is happening.
    Also, maybe lower the bounce to 2 or 1 even, since 4 will cause it to bake slower without any clear benefit in this specific scene.

    Ps. Please have a look at a talk I did which is on youtube. "Bake it til you make it" and one I did for Progressive for GDC "Make is shiny". If you haven't done baking before, it might get you up to speed :)

    Cheers!
     
    Tset_Tsyung likes this.
  9. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Hi @JenniferNordwall ,

    Many thanks for the reply! XD

    Will get on that and privde you with the screenshots soon (have to pop out for a little bit).

    I asked myself this same question. I have currently turned off the Baked GI in favour of a 'simpler solution' (at least, I think it's simpler) and it looks fine. Although I wanted to bake for experimenting, performance practice and the like so will try your recommendations and get back to you.

    I will DEFINITELY give those a look. Was looking for some kind of information/tutorial videos but wasn't finding much. Thank you for the titles, I'll search for those and have a good look.

    Again, many thanks. I'll get back to you with the results soon (only just figured out how to find an object on the global map, LMAO)

    Edit:
    Sorry, when you said this:
    Which setting were you referring to? (Being a little dumb today...)
     
  10. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Hi @JenniferNordwall

    Whilst awaiting your reply about which setting I should be changing I ran another bake with these results and settings.

    ScreenShot:
    MondaysResults.PNG

    Settings:
    MondaysResults1.PNG MondaysResults2.PNG

    Lightmaps:
    (close up of a table item - 1 of 3)
    MondaysResults3.PNG

    Total Lightmap:
    MondaysResults4.PNG

    There are also some warnings about overlapping UV's (to do with my custom models being imported) however, as you can see from the blender screenshots AND the lightmaps there are no overlapping cells. But, as @newjerseyrunner said, this does look like overlap...


    I feel I should mention another piece of the puzzle. I originally tried to replicat what I saw on a Brackeys video where he used planes with an emissive material for baked lighting (it was this video that made me want to look into baked lighting), however when I am trying to use an emissive material on a plane it simply will not bake ANY results from these lights. This is why I was mixing the realtime with the baked - because I was needing point lights to reproduce was I was trying to achieve with the emissive material...

    Anyway I hope that hasn't muddied the waters any further...

    Mike
     
    Last edited: Oct 8, 2018
  11. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi

    Regarding the overlaps, which seams to be your biggest issues, you can go to the Scene dropdown, and select "UV-overlap". You can also view these in the lightmap preview if you select it in the dropdown. If you don't find them there, maybe try to update your Unity version.

    https://www.gdcvault.com/browse/gdc-18/play/1024840

    Watch it at 16:27 where I talk about the UV overlap and
    . Here I talk a lot about these issues and the tools we have to debug them.

    I would really just maybe watch those 2 talks, and some more about this, and then let me know if you still have issues. Baking light isn't super easy, and there's a lot of settings and pitfalls that can drive you crazy. Hopefully we can solve this together :)

    Cheers!
     
    Tset_Tsyung likes this.
  12. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Hi Jennifer,

    I will watch those videos today (already start that first one, just stopped at that bit, funnily enough) and get back to you. Again, thank you so much the help, everyone.

    Mike

    P.S. Jennifer, it's nice to know that even you Unity Gurus struggle at times ;)
     
  13. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    @JenniferNordwall

    Hi Again,

    Okay, I've watched that first video ("Bake it til you make it"). It was so informative. I just thought the Unite conferences were just talking about upcoming stuff (like StarCon), I'm DEFINITELY watching them more from now on!

    (The solution was found at 25:55 where you state a rough minimum spacing that's needed between cells)

    Basically, the problem is solved (at least to a standard that I'm chuffed with). You're absolutely right (@newjerseyrunner , you too), it is the overlap of the UV's - I thought using the ones I made in Blender would be enough - it wasn't.

    I ramped the "Pack Margin" of the "Generate Lightmap UV's" advanced options in the mesh importer up to 37 and that is doing wonders. I'm able to tweak the other options a bit more now and get results more to what I want.

    FinalSettings.PNG

    I'm still experimenting with the Realtime and Mixed options... but the point is that it's been pretty much solved. Again, thank you so much.

    FinalResults.PNG

    Summary:
    Tweaking the 'home made' Lightmap UV's I made in blender was not enough to get a large enough spacing between the cells. I had to adjust the options on Unity's mesh importer and boost the "Pack Margin". This pretty much solved the issue.

    Thank you so much for the help Jennifer - you're a legend.

    All the best in your work - it's really appreciated by all of us Unity users! XD

    Mike
     
    Last edited: Oct 8, 2018
  14. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Happy that I was able to help, and good luck with all future baking :D
     
    Tset_Tsyung likes this.