Search Unity

Imported FBX not baking lightmaps in Unity 2021.3.1f1 [Solved]

Discussion in 'High Definition Render Pipeline' started by spieluhr_x, May 1, 2022.

  1. spieluhr_x

    spieluhr_x

    Joined:
    Jul 9, 2015
    Posts:
    6
    Hello,

    I've been struggling with this issue for like a complete day, so far looks like a bug in the latest LTS 2021.3.1f1 version using the HDRP (havent tried with other pipelines)

    The problem seems to be that Unity doesn't bake lightmaps on custom imported geometry, but it does on their own (planes, spheres etc). I have tested the same geometry on Unity 2019.4.38f1 and they baked correctly so it's not a FBX problem.

    Here's the steps

    1.- I imported my custom geometry as FBX, with the generate lightmaps UV's disabled as my geometry has already UV's (doesn't matter anyway, none of them worked).

    2.- Add my elements to the hierarchy, marked them as static to receive lightmaps.

    3.- Added a spotlight, set it to baked only and adjust some settings like intensity and cast shadows on.

    4.- Set my lightmap settings to a medium level and hit the bake button.

    5.- Now, for the sake of my experiments, I added some of the Unity 3d elements in order to see if there was something wrong with my light, but as you can see in the images, the light bakes just fine on the default geometry, but fails to draw on my custom.

    6.- The debugging mode shows lightmaps perfectly fine.

    Does anybody knows whats going on?

    Should I fill a bug report?
     

    Attached Files:

  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    Can you share the scene?
     
  3. spieluhr_x

    spieluhr_x

    Joined:
    Jul 9, 2015
    Posts:
    6
    Sure, I can share my project but you should know it's almost 3 GB on disk (1.5 zipped).

    https://drive.google.com/file/d/103jxBh523ZuP0Fot4Ez6SX114V8QGHHs/view?usp=sharing

    However, I think you can replicate the problem by just importing an FBX created with any DCC program.

    So far in my tests I have used Lightwave, 3ds Max 2022, but I think it will be the same if you import something from Blender or Maya.

    Unless I've been missing something really important or something changed drastically from 2019 to 2021.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    I don't think it's that simple, I have multiple projects with a ton of FBXs and I use lightmapping all the time, so there's something more going on.
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    upload_2022-5-2_3-36-39.png

    For whatever reason a lot of your materials are imported as having Metallic 1. Just create a new material you can edit and apply it to all meshes and then make sure you have Metallic 0.
     
  6. spieluhr_x

    spieluhr_x

    Joined:
    Jul 9, 2015
    Posts:
    6
    Oh man, you were very right! Thank you so much!

    Those settings comes as default from my DCC program, so at this very early stage I'm in, I didn't care about them.
    I also found my settings for the exposure were wrong, leading to inaccurate visualization of the lightmap.

    Funny thing is materials weren't an issue on 2019.4, I guess they updated something to make it more accurate.