from max sdk

解决了一些关于material的疑惑。

In MAX, every texture or material may have sub-texture or sub-materials. Materials that have sub-materials are referred to as meta-materials.

不明白texture可以有sub-texture和sub-material,还是只能有sub-texture?Mtl是不是就是这里说的Material?

In 3ds max there is only one material per node. In the INode class there are methods GetMtl() and SetMtl() that provide access to the node's material. GetMtl() returns a pointer to an instance of class Mtl.

virtual Mtl *GetMtl()=0;

Returns the renderer material for the node.

The material returned can be any material that may be assigned by the user. These include those from 3ds max itself as well as those created by third party developers. One may look at the Class_ID of the material to determine its type. For example, the 3ds max Standard material has a Class_ID of DMTL_CLASS_ID while the Multi/Sub-Object material uses MULTI_CLASS_ID. See List of Class_IDs to review the complete list provided by MAX.

Subclasses of MATERIAL_CLASS_ID

CMTL_CLASS_ID - Top/Bottom Material.

MULTI_CLASS_ID - Multi Material

DOUBLESIDED_CLASS_ID - Double sided Material

MIXMAT_CLASS_ID - Mix Material

Let's consider the case of accessing properties of the 3ds max Standard material first. If the Class_ID returned is DMTL_CLASS_ID then it's a Standard material. This material does not have any sub-materials, but has many parameters that a developer may need to access.

Next, let's consider access to the properties a Multi/Sub-Object material. If the Class_ID returned is MULTI_CLASS_ID then it's a Multi/Sub-Object material. The multi-material is a plug-in that uses the MtlID assigned to each face of a mesh as an index into the list of sub-materials. There are methods of the Face class getMatID() and setMatID() to access the MtlID for each face. Additionally, the Mesh class has methods getFaceMtlIndex(int i) and setFaceMtlIndex(int i, MtlID id).

Note that the meaning of this material index assigned to the face is specific to the type of material. A third party developer could write a material that used the ID in an entirely different manner than 3ds max does.

//哎,和没说一样,标准的max是怎么样的了?

For a multi-material, a developer can use the methods of MtlBase::NumSubMtls(), GetSubMtl(i) and SetSubMtl(i, Mtl* m) to access the sub materials.

NumSubMtls()和GetSubMtl(i)明明是Mtl的函数,哎,max,你真强。

posted on 2005-04-07 23:01  ChenA  阅读(1073)  评论(0编辑  收藏  举报

导航