microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++

Home Page:https://walbourn.github.io/directxtk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Materials with the same name overwrite each other

alekasm opened this issue · comments

commented

I've noticed that when I export to an obj/mtl combination and use the DirectX Mesh Convert tool to create the cmo, materials with the same name overwrite each other.

Example 1:
A.obj -> A.mtl
A.mtl has newmtl _2, newmtl_3

B.obj -> B.mtl
B.mtl has newmtl _2, newmtl_3

When I import the objects into my game the materials from A or B overwrite each other.

This is what the object looks like in Blender:
image

Here is what it looks like in-game:
image

Here is what other objects I have with deconflicted material names look like:
image

Material "sharing" is an important strategy for controlling memory resource usage, so a common practice is to 'merge' all materials with the same name.

That said, you can easily turn this off by setting a flag on the IEffectFactory you are using. See the wiki.