Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity changes imported UV2

Discussion in 'Global Illumination' started by gurayg, Apr 8, 2021.

  1. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hello everyone,

    I've prepared an object in Blender. Some of its meshes have no UVs, some have UV1 and UV2.
    Here is my UV2. In total 3 meshes contribute to this final UV2. Full object has 6 meshes.
    blender_UV2.jpg

    My import settings are like this.
    import_settings.jpg

    "Generate Lightmaps UVs" setting is disabled. I want my custom UV to be used while baking. I don't see any overlapping UVs in scene "UV Overlap" display.

    Here is my Lightmapping setting.
    lightmap_setting.jpg

    After baking I can see my Atlased UV changed. I can't understand why it is being changed.
    lightmapUV.jpg

    I tried changing lightmap resolution and padding settings but no luck.
    I tried "Swap UV" and it didn't help.
    My object is pretty basic. I check several times for a hidden triangle but no luck there either.

    Can anyone help me and tell me what am I missing?
    Thanks
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey! When you say UV1 and UV2, are you referring to those UV channels explicitly? Or are you referring to the first and second UV channels? Keep in mind that UV channel count starts at UV0 which is used for diffuse/albedo UVs. UV1 (the second UV channel) is used by lightmaps.
     
  3. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Thanks for the reply @kristijonas_unity . I was referring the second UV channel.
    I know UV channels start from 0 but tooltip for "Generate Lightmap UVs" reads as follows. So I was confused a bit what to say.

    tooltip.jpg

    Now I understand this could be a typo.

    In Blender I only have 2 UVs. I expect Unity to use the second one while lightmapping.
     
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    I've just noticed that you have mentioned having a single object consisting of several meshes. In this case, what you are seeing is intended. Unity's lightmap packer will draw a bounding box around the UVs of each mesh instance and pack it accordingly. Seeing how you have multiple meshes, this is the reason why the layout you are seeing in blender differs.

    If you want to be very strict about the way your meshes are packed, you have to merge them all into a single mesh.
     
  5. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Thanks again!
    I can of course do that but what if that mesh has 3 different tiling diffuse textures? Example: Wall, Ground, Ceiling tiling textures. Can I do this in 2 UVs?
    I'm sorry if this is going out of topic.
     
  6. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Well I should have tried what I've said before asking :)
    I was able to assign different materials to different faces, scale the UV island how I wanted. Unity imported the mesh with multi material + correct Lightmap UV.

    Thanks for your help!
     
    kristijonas_unity likes this.