Home Technical Talk

When we say multiple material id on a single model, what do we mean?

polycounter lvl 6
Offline / Send Message
bitinn polycounter lvl 6
I just got a bit confused myself:

- Are "material id" assigned by sub mesh, uv island, smoothing group or some other mesh property? Can you just pick any polygon and assign them a "material id", but not cause it to become a submesh?

- What does it mean to have "multiple materials on the same model"? Does it imply the model contains "sub mesh" ready for material assignment?

- Each polygon should only match a single material id, right?

Please help.

(I am not a 3DS Max user, I am just thinking of "material id" as a way for modeling software and game engine to assign materials to a model's polygons accordingly)

(I recently encounter a modeling tool that split mesh into sub mesh on export, using material id as group, I am not sure this is a requirement of obj wavefront spec, or just the tool decided to do that to keep 1 material per mesh...)

Replies

  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    yeah you can assign materials for a single polygon or an entire mesh.

    You usually break them up based on what resolution you need your textures. So maybe you have a human character. You first assign one material for the entire body including the face. And then for that material you make 2k textures. But then you realize the details on the face are a little to blurry. So you split it into two materials. Now you can get more resolution per material. Modern AAA characters can have like four or more materials sometimes. Eyes, skin, hair, clothing...

    IIRC UE4 can work with multiple materials exisitng with a single mesh. But Marmoset Toolbag I don't think can do thatt. I'm not sure exactly, but almost positive you can in UE4. In Unity it's probably possible but likely you need to write a shader for that. Just guessin though.

    You'll find better reading about this on the wiki, but honestly it's quite easy to understand just by going through the process of making a complete model a few times. It is quite confusing if you are only reading about it simply because there is many options and many considerations for different types of jobs.
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    yeah you can assign materials for a single polygon or an entire mesh.

    You usually break them up based on what resolution you need your textures. So maybe you have a human character. You first assign one material for the entire body including the face. And then for that material you make 2k textures. But then you realize the details on the face are a little to blurry. So you split it into two materials. Now you can get more resolution per material. Modern AAA characters can have like four or more materials sometimes. Eyes, skin, hair, clothing...

    You'll find better reading about this on the wiki, but honestly it's quite easy to understand just by going through the process of making a complete model a few times. It is quite confusing if you are only reading about it simply because there is many options and many considerations for different types of jobs.

    Let me try to summarize your answer, do tell if I am mistaken:

    - Material ID / Material assignment isn't limited to any "group" of polygons, I can assign them at will, and still keep them as a single mesh, without any sub mesh.

    - But each polygon should have only 1 material id.

    (I just tried Blender and it seems to work as expected, so for now I am blaming that particular tool that force sub mesh creation based on material id...)
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    @BIGTIMEMASTER in your 'blurry face' example you wouldn't create 2 separate materials as they are both the same material, you would split the material into extra uv channels.
  • FourtyNights
    Offline / Send Message
    FourtyNights polycounter
    With game assets, 1 material on a 3D object equals 1 UV set. Yes, you can have multiple materials on a single object/mesh or on separate objects/meshes, and you can assign a different material to each polygon... but it's not practical. Generally you choose a group of polygons representing a certain part of your object, where you'd like to have more resolution/details. But that part needs to be treated as a separate thing with an UV set, bakes and textures. It's also a good practice to work with separate materials as their own object for the sake of simplicity and isolation. You can join objects into one single object later on if you wish, while keeping all the materials in place. UE4 can also combine multiple objects into one during the import dialog, just mentioning.

    Material ID is a bit different term. It usually means a baked "material id map" for a one material/UV set for quick masking in Substance Painter, where you define different dielectrics and metals from each other.

    The most necessary material split happens between transparent and opaque materials, since transparency sorting brings issues if having one material with transparent and opaque elements at the same time. So, those should always be separate materials. Like character's hair, eyebrows and eyelashes are always separated from other materials on the character. It's mandatory with this case.

    @musashidan I'm a bit confused here. Every material/UV set should be on the same 1st UV channel, and the 2nd UV channel is for hand-made or generated lightmap UVs, right? Like for example when I separate my character's head and hands, they are separate materials/UV sets, but on the same UV channel 1. In a sense they are the same material, skin. But in Substance Painter I texture them separately and just try to match the skin to look the same.
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    @FourtyNights you can have multiple textures in different uv channels. In UE4 I think you can have up to 8. You lerp texcoord nodes set to the different channels with the RGB channels of your mask. 

    So for the example above the skin would be a single material and the face/body uvs would be on different channels and lerped using a custom mask.
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    @FourtyNights

    I guess we need to establish what a material is first:

    In my mind: 1 material = 1 shader variant + some inputs. You can use as many Polygon / UV / Texture as you like, as long as the hardware/engine support it (eg. number of interpolators).

    So to me: multiple materials = multiple shaders + sets of inputs (they can be similar or different). If you have a model with multiple materials, it simply means you render the model with different shaders or inputs.

    (polycount post editor is broken on Safari, it inserts links unnecessarily and I have to use HTML mode to fix them...)
  • FourtyNights
    Offline / Send Message
    FourtyNights polycounter
    @musashidan Okay, that's something I've never heard of as a workflow. Gotta ping you someday when I come up with a character project soon to see how it works in practice. :D I've always just used separate materials on a single UV channel and that's it, so this is completely new to me.

    @bitinn I'm not sure what you're trying pursue with these deliberations anymore, but I think you're overthinking. Looking at your thread history of your questions about different subjects, they escalate quickly into more complex questions and speculations, where not many of can answer so easily anymore. But if I remember right, you have a programming background?

    It's just that, I'm already lost what you're trying to look for (but that's just me I guess, lol). I'm a bit simple-minded 3D artist with no programming background, so I apologize if I'm not following everything you talk about. I'm just trying to get into the root of your problem here. :D

    But... if I try to get what you're talking about now... yeah, for example UE4 has a material output for different texture types, and packing greyscale images to different color channels help to optimize the material and so on... but that wasn't the topic in a way, so let's move on...

    In general though, the more important or bigger the game asset gets (usually a hero asset), the more multiple materials you'll need to keep details consistent, simple as that. Especially in UE4, with LODs you can simplify the object by baking down the materials and textures to a single material and a texture. Even the material for LODs can be a lot simpler without fancy material defining texture maps, and just just an albedo and a normal map, just as an example

    If working in a studio, it's up to their optimization requirements how many materials per object uses, depending on how important it is for the camera to see and render it real-time.
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    @FourtyNights no worries, I was just thinking out loud. In practice I do know what I should be doing.

    The whole reason for my thread was I encountered a strange tool that force mesh to split into sub mesh by material assignment, so I got confused. Other tools like Blender doesn't do this.

    And I guess "Material ID" is indeed a term with multiple meaning. I wasn't talking about id map (which is a texture you baked for other texturing), but the material id "slot" assign to polygons (which is used by game engine to actually assign materials, for rendering).

    TL;DR: I think I got it, thx all.
  • FourtyNights
    Offline / Send Message
    FourtyNights polycounter
    @bitinn No worries, mate. Oh yeah, the "Material ID" was something that both Quixel and Substance products started using for their masking system, so it got a new meaning that way.

    Just for fun, the first result when googling "material id" brings up 3ds Max's documentation about assigning material on the polygon level to a sub-object. I find Max's terminology quite weird sometimes, that even Maya makes more sense, and Maya is more on par with Blender's terms. So the "sub-object" is a mesh element in the object's parts. But then again Blender's "linked selection" is a bit weird term too, so I think it should be just "element selection". Anyway this gets off topic, so good that you got it though, haha.
  • Eric Chadwick
    Some older file formats will force the models to be split on material seams. .3ds for example. Because the format itself can only store 1 material per vertex (1 vertex normal per vertex, 1 UV coordinate per, etc.) This might be what you ran into.
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    Some older file formats will force the models to be split on material seams. .3ds for example. Because the format itself can only store 1 material per vertex (1 vertex normal per vertex, 1 UV coordinate per, etc.) This might be what you ran into.
    That's what I thought initially, but then I tried Blender and compare results (both files are cubes, with hard edges):

    The blender export simply assign material to faces.



    while the tool I was using, created groups for each material.



    The end result: Unity decides to import the model as 2 sub mesh. And I was left thinking: wait, does other tools do this or was it just this tool being weird...

    (the tool was ProBuilder by the way.)
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    a bit late but thanks for the clarification guys. My understanding is purely practical from working in Unity or Unreal, but looks like I wasn't using the right terms. To me, so far, material has always equaled = one UV layout.
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    @bitinn No worries, mate. Oh yeah, the "Material ID" was something that both Quixel and Substance products started using for their masking system, so it got a new meaning that way.


    MatIDs have been used or a long time in offline rendering/compositing. Also, Max's RTT baking tool has had an explode bake MatID feature for as long as it's been in Max(10 years or so?) long before tools like Substance came up with the 'match by mesh name' concept.

    As for the mulptiple uv channel per material workflow I'm not sure how cheap it is in terms of compilation/instructions, but I'm sure it's cheaper than multiple materials. It does add to the vertex count, but not significantly.
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
     To me, so far, material has always equaled = one UV layout.
    Your layout can be completely different between channels(although UE4 uses the base 0 channel as the normal directions so you can't rotate islands without lighting rendering errors on NMs) this is how lightmap uvs are utilised. The texcoord node in UE4 allows channel lookup.
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    that is the type of stuff an enviro/lighting artist would be using? not typically character artist tools?
  • Eric Chadwick
    Typical env workflow is to generate tiling UVs in uv0, and atlas lightmap UVs in uv1.

    If your modeling app starts with uv1, then it's uv1 and uv2. Same thing tho.

    But there's nothing stopping a game dev team from adopting any uv channels they want. And any material IDs they want. Except if the file format or engine has specific limits.

    There are no hard rules about which material uses which UV. It's up to the team to decide what they want to enforce. Then implement it in their shaders.
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    that is the type of stuff an enviro/lighting artist would be using? not typically character artist tools?
    Typically, yes, but your skin scenario I used is a good example of where it could be used for a character. It all comes down to the pipeline, and how that is being optimised. Complex materials with lots of texture sample nodes are expensive/slow to compile and cost texture memory. I'm not a tech artist or programmer though so my knowledge of the 'under the hood' stuff is limited compared to many others here.
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    gotcha. yeah i mean i have some notion about these things just from reading around but i've never had a need to dive into multiple UV channels or lightmaps or anything like that as a studying character artist, so I figure thats the kind of more technical project based thing you'd pick up working in a studio (as a character artist)
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    I'm just a nerd like that, I'm constantly seeking to learn as much as I can even if I'll never/rarely use it. :D
Sign In or Register to comment.