This is an old revision of the document!
In some versions of the SpeedTree Modeler, you have the option of exporting to a simple “Game Editor” format, that is normally used for importing to specific game engines. This will show a different export dialog with more options specific to real-time rendering and games. Currently, the exporters for UnrealEngine4, Unity3D, and Lumberyard all use this dialog.
These options set which type of geometry from the tree to include: the fully 3d geometry LODs, the billboard LOD, or all of it.
Geometry LODs are what you are editing when you make a tree. You can adjust the number of LODs, how the tree changes as it goes down in LOD, and the smoothness of these changes. Please see the Level of Detail section for more information.
If you enable billboards to be exported, one new LOD is added at the end of the LOD transition. This LOD is a very simple mesh made of pictures of the tree rendered from different views. These billboard pictures are all placed into a billboard atlas. All the same material maps that are exported for regular geometry are exported for billboards, so it can fit into your normal rendering pipeline. The game engines handle removing the views that are not facing the camera, and you are left with a simple picture of the tree in the distance. With this method, you can have very dense forests at real-time speeds.
This section of the dialog features options for extra things that may be included during export.
Variations may be set up in the material. This option enables the processing of variations on export. Instead of requiring the final game engine to have shader code that does the variation, the exporter will simply make new materials and textures with the variation information baked in.
Note: Variations should be used sparingly on real-time SpeedTree models to avoid too much extra texture space being used. If atlassed, the variations of a material will take up multiple places in the atlas. If not, additional textures will be made.
Seam blends are the small piece of geometry that hides the intersection of a branch to its parent by blending the parent material over top of the child branch. This is done using vertex alphas to fade it out. If the engine does not support per-vertex alphas, or if z-buffer problems are causing the seam blends to flicker, then you may disable this. Even without per-vertex alphas (and thus a hard line where the material changes), the blend pieces usually add to the realism of the tree by hiding the actual branch intersection.
Atlassing is the most important aspect of preparing a tree for real-time rendering. Putting multiple materials into the atlas allows the geometry that uses them to be merged, resulting in fewer draw calls. With aggressive merging, you can make an entire tree that renders in one draw call.
|None||This option does not make an atlas. Each material will export its textures separately|
|Non-Wrapping||This option looks at the geometry using each material. If the UVs on the geometry fit within 0-1, then its material will be put into the atlas. Geometry that uses wrapping UVs or otherwise has UVs outside of 0-1, such as branches, will be exported as separate textures|
|Everything||This option puts every material in the entire tree into the atlas. Any geometry that has UVs outside 0-1 will be unwrapped before going into the atlas. Without being cognizant of this, you could end up with a suboptimal atlas layout. Enabling V-wrapping (see below) helps branches to not take up so much of the atlas when their UVs are outside 0-1.|
When geometry has UVs outside 0-1, they need to be unwrapped in order to be placed in the atlas. If they aren't, these UVs may start referencing the textures surrounding its material in the atlas. However, some things may wrap UVs a lot, such as branches. If these were unwrapped and placed in the atlas, they would be so much bigger than everything else, it would result in a suboptimal atlas layout. Also, since you have a maximum billboard atlas size, you may lose a lot of texture resolution as the whole UV space is squeezed into the atlas.
This is where the V-Wrapping option can help. When enabled, anything that wraps in the V direction will get placed in the atlas such that its top and bottom edge touch the top and bottom of the atlas. Thus, V-wrapping UVs will work just fine and you keep much more of the texture resolution. You still need to be cognizant of U-wrapping, but since branches wrap a lot in V and not so much in U, this is a great feature when putting branches into an atlas.
See the picture below for an example of a one-draw-call tree where everything has been placed into the atlas, utilizing V-Wrapping so as not to lose texture resolution on the branches.
When placing materials into an atlas, these materials get merged together. While they use the same textures, sometimes you may want to split the materials based on a number of factors. For example, a common situation is that leaves need to be two-sided but branches should cull backfaces. Enabling “Separate Materials” will split up the materials based on the things that do not get written into the textures. For now, this is just the two-sided flag.
These options modify the output geometry, such as flipping and rotating it for a particular coordinate system. In most of the game-specific exporters, these are either disabled or pre-filled with the most common values for that particular engine.
These options deal with the creation and writing of all the textures needed for the tree during export.
This option sets the format of the exported textures. For some game engine, this format is locked to the commonly-used format (usually PNG or TGA).
With the size options, you can set the size of the atlas, the size of the billboard atlas, and the max size of any other texture written.
This option lists the various forms of texture packing available. These change on a per-engine basis. For example, a particular engine may expect color and opacity in one RGBA texture and the normal and gloss in another. But another engine may expect metallic and gloss to be in a different texture, etc.
Advanced: If you wish to add a new method of packing or change how texture packing is performed, you can edit the shaders and xml descriptions of each packing type in the application bin directory texture_packing. Note that you will also need to update whatever importers are being used in the game engine to match. Please contact SpeedTree Support if you need more information.