Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Determine where materials change?

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
158 Views, 5 Replies

Determine where materials change?

Hello again, people 🙂

I'm setting the mapping mode to eBY_POLYGON_VERTEX on all my elements, then optimizing later. However, for batch drawing in graphics rendering, how might I find out on which vertex do the materials change?

Example:
There's three materials on a mesh. After converting the mapping mode to eBY_POLYGON_VERTEX, the first material uses vertices 0-6, the second uses 7-12, and the third uses 13-23. Where would I find these values?

Many thanks! You have all been very helpful!
-Thomas
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

Bump.

These are also called Material Groups in other formats, such as ASE. Does anyone know how to get a hold of these?
Message 3 of 6
Anonymous
in reply to: Anonymous

I seem to have found what FBX uses instead of "material indices," which makes more sense for the format but is a bit more challenging to process.

If there are multiple materials in the same FBX file, they're stored in different layers. This is seen in the "Layers" example. Each different material + corresponding UVs are presented in each different layer, whilst all the geometry/normals/etc are present in the zeroth layer.

I'm using 3ds Max to create these models. You can set multiple materials for the same object via material channels for each face. How do you retrieve these faces in FBX?

Thanks,
-Tom
Message 4 of 6
Numerator
in reply to: Anonymous

Look at DisplayMesh.cxx in the FBX SDK ImportScene example.

function DisplayMaterialMapping


leMat->GetIndexArray().GetAt(i)


returns each face with that material applied
Message 5 of 6
Anonymous
in reply to: Anonymous

Perfect, this is exactly what I was looking for! Thanks again, Doug. Merry Christmas to you.
Message 6 of 6
Numerator
in reply to: Anonymous

Look at DisplayMaterialConnections, also

There is a special case: KFbxLayerElement::eALL_SAME

Merry Christmas to you, too.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report