3DXI Materials and Textures

Materials are stored globally as IGameMaterial, with each node providing an index into this global array. The standard 3ds Max material (StdMtl2) is directly supported with methods for getting basic material data such as ambient and diffuse color, glossiness and opacity. Other material found provides access to the IPropertyContainer so that parameter extraction is possible using IGameProperty.

The multi-material is supported, with access to the sub-materials, the material ID being used on the sub-Object level. Materials also provide access to any texture that is used, with direct support for bitmap textures. All properties of bitmap textures, including clipping data, are supported.

3DXI supports DirectX 9 Shader Material using IGameMaterial. Direct 3D effect data is held in the IGameFX interface and access to global parameters, samplers, and transform data is provided. The following code is an example:

// mat is a pointer to an IGameMaterial
TSTR buf;
int texCount = mat->GetNumberOfTextureMaps();
for(int i=0;i<texCount;i++)
{
     IGameTextureMap * tex = mat->GetIGameTextureMap(i);
    TCHAR * name = tex->GetTextureName();
    if(tex->IsEntitySupported()) //its a bitmap texture
    {
        IGameProperty * prop = tex->GetClipHData();
        DumpProperties(bitmapTexture,prop);
        prop = tex->GetClipUData();
        DumpProperties(bitmapTexture,prop);
        prop = tex->GetClipVData();
        DumpProperties(bitmapTexture,prop);
        prop = tex->GetClipWData();
        DumpProperties(bitmapTexture,prop);
    }
}

Textures also provide access to the coordinate rollout data used by textures to handle transformations. Either the complete transform or the individual elements that make up the transform can be accessed.

Note: 3DXI does provide the ability to export faces based on either smoothing groups or material IDs.