In addition to the export formats natively supported by the SpeedTree Modeler, you can create a custom exporter that will translate SpeedTree data into any final format. This custom exporter can be used during static mesh or game exports.
Note: Custom format exports are only available in SpeedTree Cinema and SpeedTree for Games (not subscription versions).
Custom mesh exporting from the Modeler was designed to be as flexible as possible for the developer writing the exporter. For this reason, temporary files are used to pass data from the application to the exporters. This allows the exporter application to be written in any programming language or framework since it is not tied to a specific API/language/version that can interface with the Modeler.
These intermediate files are simply raw XML files that contain all the geometry information needed for the exporter, and they can be exported from the Modeler directly, as well. The exporter application needs to be able to take the XML filename on the command-line.
Custom exporters need only be concerned with the geometry stored in the raw XML file and the final format. All textures are already handled for you by the Modeler.
In order for the Modeler to be able to find and run a custom exporter, it must be placed in the <apps>/custom_exporters directory. This directory may need to be created.
Additionally, a small file describing the exporter needs to be placed with the exporter application. This file is also XML and needs to have the “.sme” extension. An example of an “.sme” file and descriptions of each value are shown below.
<?xml version="1.0" encoding="UTF-8"?> <SpeedTreeMeshExporter> <Name>Custom File</Name> <Executable>executable</Executable> <Extension>cus</Extension> <ExtraArguments></ExtraArguments> <GameExporter>true</GameExporter> </SpeedTreeMeshExporter>
|Name||Name of this exporter that shows up in the export file dialog|
|Extension||The final file extension for this exporter|
|Executable||The file name of the executable application to run|
|ExtraArguments||Any extra arguments to be passed on the command line to the exporter application. This can allow you to have one single exporter application with a number of different exporting features through multiple .sme files.|
|GameExporter||This value should be true or false, depending on if this exporter is to be a game export|
The basic hierarchy of the XML in the raw file is fairly simple. See the description of each major section below…
<Objects> All geometry objects, grouped by the settings in the export dialog. In game exports, there is one object per LOD. <Object> Each group of geometry <Points> Points are the unique positions in the object <Vertices> Vertices include all of the other vertex data (normal, texcoord, vertex color, etc.) <Triangles> Each triangle group includes the indices to draw a section of geometry as triangles with the indicated material <PointIndices> For each corner of each triangle, the index into the point data <VertexIndices> For each corner of each triangle, the index into the vertex data <Quads> Each quad group includes the indices to draw a section of geometry as quads with the indicated material <PointIndices> For each corner of each quad, the index into the point data <VertexIndices> For each corner of each quad, the index into the vertex data <Leaf References> Each leaf ref includes the information about the anchor point to instance meshes for leaves (only exists if leaf references are enabled) <Bones> All the bones/skeleton set up for this tree in the Modeler <Bone> Each bone. Data includes id, parent id (to reconstruct the hierarchy), and start and end position <Meshes> This separate mesh data can be instanced over the leaf references to recreate the leaves in a tree (only exists if leaf references are enabled) <Mesh> Each mesh used <Lod> The LOD for a particular mesh <Vertices> All of the vertex data: position, normal, vertex color, etc. <TriangleIndices> Indices to draw this mesh using triangles <QuadIndices> Indices to draw this mesh using quads