User Tools

Site Tools


Materials

To ensure material accuracy, be sure to use STE files, not SPM. Please see the previous section on Input Files for details.

Materials are queried using SteGetGeometry(). It’s possible to query only the material information, bypassing the geometry and other data, by setting the appropriate flags in SSteGeometryOptions.

Material definitions are straightforward as shown in this listing below.

///////////////////////////////////////////////////////////////////////  
// Structure SSteTextureMap  
 
struct SSteTextureMap  
{  
    bool                m_bTextureMapUsed;      // if true, use m_szFilename texture, otherwise use 
                                                // m_vColor in place of map  
    SteFilename         m_szFilename;           // texture map filename  
    SSteVec3            m_vColor;               // fallback constant color  
};  
 
 
///////////////////////////////////////////////////////////////////////  
// Structure SSteMaterial  
 
struct SSteMaterial  
{  
    SSteTextureMap      m_aMaps[STE_MAP_COUNT]; // bank of PBR texture maps  
 
    bool                m_bTwoSided;            // e.g. true for palm fronds, most leaves  
    SteStringLarge      m_szUserData;           // user data as specified in the Modeler app  
    SteStringLarge      m_szName;  
};  

This definition is primarily just a set of PBR textures and when a texture isn’t provided, a fallback color is. SpeedTree uses the following PBR map types (defined in ESteMapType):

  • Color/Albedo
  • Opacity
  • Normal
  • Gloss
  • Specular
  • Metallic
  • Subsurface
  • Subsurface Amount
  • Ambient Occlusion
  • Custom

Here is an example for reading just the materials from a SpeedTree model.