User Tools

Site Tools


STF Files

The SpeedTree Forest (STF) file format is a simple text file that contains the names of base trees and the position, rotation, and scale of all instances of each tree in a scene. STF files are intended to be easy to read and understand and are not necessarily for production (they are ASCII text files after all, not streamlined binary files).

Note: The STF file format changed in version 5.2 to support the format used by the SpeedTree Modeler's world builder exporter.

STF File Format

STF files are ASCII text files that contain a list of each unique tree instance in a given scene. The data stored for each tree are, in order, the SRT filename, and the number of instances of the tree. The position, rotation (in radians), scale, and other data for each instance follows. The following BNF describes the structure of an STF file.

<STF File>    ::= { <Tree entry> }
<Tree entry>  ::= <Filename> <Instances>
<Filename>    ::= { <char> }
<Instances>   ::= <unsigned int> { <Placement> }
<Placement>   ::= <X> <Y> <Z> <Rotation> <Scale>
<X>           ::= <float>
<Y>           ::= <float>
<Z>           ::= <float>
<Rotation>    ::= <float> [radians]
<Scale>       ::= <float> [1.0 = no scale]

The listing below demonstrates a sample STF file:

Agarwood.srt
1
-40.4579 33.0828 0 0.773471 1.25

BostonFern_Cluster.srt
3
32.5914 112.758 0 0 1
32.5914 58.273 0 0 1
32.5914 16.9102 0 0 1

WeepingWillow.srt
1
-40.1446 -46.1798 0 0 1

WhitePine.srt
3
29.6862 -16.0832 0 0 1
29.6862 -35.3341 0 0 1
29.6862 -54.0787 0 -0.749767 1.571

Parsing STF Files

The reference application contains a utility class, CMyPopulate, that provides utility functions for parsing STF files.