Search Unity

Importing Object with 2 uv sets?

Discussion in 'Editor & General Support' started by rmele09, Mar 19, 2012.

  1. rmele09

    rmele09

    Joined:
    Nov 8, 2010
    Posts:
    716
    I am trying to import a building that will use two textures. 1 for the main parts of the building, 1 for the windows and other details. I set this up in maya with 2 uv sets, however when I import to Unity, only one is detected. I can only apply 1 texture. I have read that unity can support multiple texture objects, and have imported objects that I have purchased that have been set up this way, but I am not sure what I am doing wrong for this building. Any help?
     
    DavidSof likes this.
  2. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Do you have auto generate lightmap UVs set in the object importer? That uses the second UV channel, so it could be overriding it maybe.
     
  3. Schlumpfsack

    Schlumpfsack

    Joined:
    May 30, 2010
    Posts:
    608
    you have to set up two materials. Dunno how it works in Maya, but in 3d max or blender you use one material for the "windows and other detail" and one material for the rest. Unwrap every "material-part" indiviual.
    You will end up with two meshes (<--not sure about that tbh,main-mesh and sub-mesh i think) and two materials that can use different textures.

    The second UV set is mainly used for lightmapping in Unity.
     
  4. larvantholos

    larvantholos

    Joined:
    Oct 29, 2009
    Posts:
    668
    by default the shaders in unity only use uv 1. So you get 1 or the other, to use the second uv set in the way you have indicated there, you need a custom shader. A better practice would be to split off the objects you want to use the second texture/uv set, so you can still lightmap them properly with beast.
     
  5. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    What you are trying to do is achievable with 2 materials, it does not require two UV sets.
     
  6. PrvtHudson

    PrvtHudson

    Joined:
    Apr 10, 2009
    Posts:
    236
    Everyone is correct here. YOu don't need two UV sets. You need to figure out how Maya tells Unity that it is to use a new material. In XSI, I create a "cluster" for the area, Unity creates a material for each cluster in the import process and then I apply whatever material I want. You select the mesh and in it's property page, it will have an array of materials. Drag your materials onto the array. Sooo one mesh with multiple materials.

    If you want to use two uv sets, you can, but you need a shader theat reads the second one. In the import options, you can use the "swap uv" button to help you determine in which order Maya exported them.

    You can leave the second uv set for Lightmapper to use. I avoid using the importer to generate the UV's because it doesn't hide the seams.

    Note : If your second UV is not showing up at all, it may be that it has been thrown out in the FBX export process. Try making sure that you have a material mapped to the second UV set.
     
    Last edited: Mar 19, 2012
  7. rmele09

    rmele09

    Joined:
    Nov 8, 2010
    Posts:
    716
    Thank you everybody for the replies.

    Iarvantholos: So do I need to split this building into two different objects?

    Shlumpfsack: Do I need to actually apply a material within Maya to each UV set? Is that what you mean?

    I am still a little confused how I can use two different materials on the same object, if somebody could expand a little on that.
     
  8. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    That woould be the fastest way, but you should really look into it.
     
  9. rmele09

    rmele09

    Joined:
    Nov 8, 2010
    Posts:
    716
    so if I break it up into two objects, do I need to import them seperately and then line them up to look like one object within unity?
     
  10. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
  11. rmele09

    rmele09

    Joined:
    Nov 8, 2010
    Posts:
    716
    Oh so If I have two objects in one maya file and I import them into unity, I can still apply 1 texture for each object even though it is 1 maya file?
     
  12. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    yes. why don't you try it though instead of posting?
     
  13. Galactic_Muffin

    Galactic_Muffin

    Joined:
    Aug 14, 2013
    Posts:
    67
    No need to be rude. It's ok for people to ask questions about something that is easy to answer to avoid wasting potentially hours of finding or testing something.

    Yes, rmele09. It can be hard to find though you must assign the materials to the actual model file in your assets under inspector. There should be an array.
     
    TabuuForteAkugun likes this.