Search Unity

How do you handle objects using two or more materials?

Discussion in 'Formats & External Tools' started by U7Games, Jun 9, 2018.

  1. U7Games

    U7Games

    Joined:
    May 21, 2011
    Posts:
    943
    Hello, I would ask you what is a better way to export an object using two or more materials... for example, here I have a desk lamp which has a base support (metallic) and a bulb (emissive).

    From 3d modeler, what is the way you use to export it...

    1) Do you separate metallic mesh and export it alone, for example: metallicDeskLampBase.obj
    then export bulb: emissiveBulb.obj

    or

    2) Do you create a material for each object in modeler and combine them into one and then export it as a single mesh using two materials: deskLamp.obj

    I personally prefer number 2, but I´m not sure if this is bad for performance, I guess not... it is the same?

    Cheers.
     

    Attached Files:

  2. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
    or
    3) create an object with one standard material and add an emission map to the material..
     
  3. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    3 is the best option in this case. Option 2 in general is fine though if for some reason you really need different materials(which emission isn't one of those). Option 1 is something Unity actually does behind the scenes anyway, no need for you to add that step.

    Generally, you can avoid splitting things up using the Standard shader, but I once ran into an issue using a semi transparent material, even using the standard shader. Trying to keep it as part of the same material led me to getting things drawn out of depth order(which makes sense all things considered), while making the transparent part be a separate material made it work fine.
     
    U7Games likes this.
  4. U7Games

    U7Games

    Joined:
    May 21, 2011
    Posts:
    943
    ok, but if I use one standard material (for instance in this case to whole lamp), the emissive map will be applied to metallic too and that is not good... (or may I was misunderstood you ?)

    The emissive case can be some special, in other case, for example a wooden door with a metallic handler, should work option 2 ?...

    Thanks .
     
  5. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
    U7Games likes this.
  6. U7Games

    U7Games

    Joined:
    May 21, 2011
    Posts:
    943
    Good suggestion...
    Thanks

    Now, for else mixed meshes using more than one material at once, for instance a wooden door with metallic handle, so in such case how good is the option 2 ?
     
    Last edited: Jun 10, 2018
  7. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    Still good, the PBR shader accounts for that because just like you can make black the parts of the emission texture that shouldn't emit, you can make parts metallic or not, so the metal knob would be metallic, while the wood would not.
     
  8. U7Games

    U7Games

    Joined:
    May 21, 2011
    Posts:
    943
    Thanks...!