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 { int m_nID; // each material has a unique ID SSteTextureMap m_aMaps[STE_MAP_COUNT]; // bank of PBR texture maps bool m_bTwoSided; // e.g. true for palm fronds, most leaves bool m_bVertexOpacity; // branch seam blending is active SteStringLarge m_szUserData; // user data as specified in the Modeler app SteStringLarge m_szName; // name of material as defined in Cinema };
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):
Here is an example for reading just the materials from a SpeedTree model.