Exporting From MAX 9

Started by
3 comments, last by mtemple 16 years, 5 months ago
Gentlemen, Does anyone understand the relationship in MAX 9 between the Materials (usually textures) and the MatID (Material ID) that each triangle face uses to reference the Materials? I have seen several meshes where there is only one Material with no Sub-Materials, yet there will be Face definitions that have a MatID of 2. How is that possible? Aren't the MatIDs always supposed to reference the materials? If you only have ONE material definition, in what universe does it make sense to reference that one material with an ID of 2? I am PLAINLY missing something big here. Help! Thanks in advance to you experts!
Mark TempleEnemy Technology"We have found the enemy, and he is us!"
Advertisement
Some Max primitives (like box) can generate multiple material IDs by default. If the artist doesn't bother to change these after creation, they can be quite a mess in the final mesh as the faces are cut, extruded, rotated etc. to arrive at the desired model.

If a single material is bound to a mesh with multiple material IDs, Max uses that material for all IDs. That's why the artist might not even notice that the IDs vary, if he/she only uses a single material. An artist might also use the faces' material identifiers deliberately for entirely different things than actual material selection, such as a face selection subset or a post-processing effect mask.

By the way, materials can refer to textures but a texture may not, by itself, be a material. This is an important concept, and quite applicable to any 3d work - be it pre-rendered or real-time.

Niko Suni

Thanks for the help Niko,

I had no choice to but to assume these errant ID's must refer to the only material that exists in the mesh. But other cases are more troubling.

In the Apple example that comes with MAX 9, the mesh is divided into 2 nodes, and there is only one material (which contains a texture map for the apple). But the stem contains no material Index (MAX passes -1 in the SDK to indicate this). However each of the faces in the stem node have material ID's from 0 to 2. If I make these faces refer to the apple texture, the stem is improperly covered with the red Apple texture, when it should be brown in color. I have tried creating a 'blank' material definition with all zeros to point the stem ID's at, but then the stem looks gray. So the issue here is that I do not know how to make the stem look brown when it's exported. There appears to be no material that would do this.

But you mentioned that textures do not need to be materials in MAX. Does this mean there may be a texture stored with the mesh somewhere but not in the materials list?

From what you've said, it appears the best course for me is to make sure my artists are very careful with their material ID's and use them only to refer to materials, correct?

Thanks again for your time!
Mark TempleEnemy Technology"We have found the enemy, and he is us!"
I last used Max two to three years ago, when it was at version 7. However, I assume that the material index system hasn't changed much between that and now.

Are you sure that the apple only has one material bound to it by default? To determine this, select the eyedropper tool from the materials window, and click the apple mesh with it. If the material swatch turns into a checkered pattern of two or more materials, the apple does indeed have two or more materials.

You could also see all used material hierarchies by using the material browser window and checking the "all in use" (or something like that) radio button.

Material indices should indeed be reserved to only specify the mesh subset (material) index. There are other ways to save selection sets and such.

Does the stem turn gray inside Max, or only after export? If latter, you might have an issue with your shader system.

You cannot bind a texture to a mesh directly (except in some geometric modifiers). Instead, you use a material, and specify - if you want to control the "basic" color of the object with a texture - that the diffuse channel uses that particular texture. You can also bind the same or entirely different texture to other channels of the material.

This concept is highly analogous to shaders and texture samplers on hardware, where shaders correspond to materials and texture samplers, well, to textures. You set both independently, but they work together at render time. A shader can work without texture samplers, but a texture sampler cannot work without a shader.

Niko Suni

The stem is only gray after export, and then only if I make it refer to a blank material, so the gray is to be expected. If I make the MatID's for the triangles in the stem refer to the only material in the mesh, then the stem is red like the rest of the apple. I'm just at a loss for how the stem is being set to brown.

But it's probably not that important to get to the bottom of it. Your advice about making sure the artists use the MatID's properly should solve the problem for our in-game models I think. And I'm sure we have some shader issues in the engine as well, so we need to work it from both ends.

Thank you so much for taking the time to reply!
Mark TempleEnemy Technology"We have found the enemy, and he is us!"

This topic is closed to new replies.

Advertisement