User Tools

Site Tools


Testing Your Tree Models In The SpeedTree Pipeline

One of the first tests many evaluators want to conduct is to model their own tree and see it in running in an environment. This page outlines the quickest way to make that happen. It covers the steps to that go from modeling a tree in the SpeedTree Modeler to seeing it being rendered in the SDK Reference Application (our sample environment). This page is not meant to get into the details of any one of these phases but rather take you through the process at a high level.

Step 1: Use the SpeedTree Modeler to Create a Model

The first thing you'll need is a custom tree model. Use the SpeedTree Modeler to create a tree model for the test. Feel free to use your own texture maps and meshes – they'll all be processed and copied to the appropriate location by the SpeedTree Compiler in the next step. There are a few things you'll want to consider when modeling the tree to make sure it performs well when rendered in real-time.

Triangle Counts

The Modeler is designed to make tree models for movie special effects as well as real-time applications. Make sure the triangle counts on your model are appropriate for your application.

Level of Detail (LOD)

Turn on LOD in your model by selecting the “Tree” generator and checking “enabled” in the “Level of Detail” group. You'll also see the LOD distances in that group. Make sure they are appropriate for your scene (the distances are in the same units as the tree model). If you thing LOD transitions aren't happening where you'd like them, edit the distances in the Modeler and then recompile the tree. Each generator has its own set of LOD controls that you can adjust to tune transition behavior. Transitions can be previewed by using the LOD slider in the Tree Window.

Wind

Enable wind by clicking on the fan icon in the Tree Window toolbar. Select the fan to reveal the wind parameters available for tuning. There is a page in the SpeedTree Modeler documentation that covers wind tuning in detail. The wind settings you see in the Modeler will be carried over to the real-time environment.

More Info

Please view this section for detailed info on modeling efficient real-time trees.

Step 2: Compile the Model

The SpeedTree Compiler takes the artist friendly model from Step 1 and creates an optimized version for use with the SDK. You must compile a tree model before it can be used by the SDK. The Compiler performs these critical tasks:

  1. Creates real-time versions of the tree models (.SPM files are optimized and converted to .SRT files).
  2. Precompiled shaders are created based on the effects enabled by the user.
  3. Texture atlases are created that combine any textures used on the tree model that aren't tiled.
  4. 360°, normal-mapped billboard atlases are created. These billboards represent what the tree model will look like at its lowest LOD.
Compiling The Tree

To Compile a tree model, launch the Compiler and do the following:

  1. Add the tree model from Step 1 by clicking the “Add Trees” button in the “Settings” toolbar and selecting the .SPM file.
  2. Select the “General” settings and choose an output directory where the Compiler will save all the data for the tree model (General→Output directory).
  3. Select the “Compile” settings check the platform on which you are going to run the test. For testing purposes select only one platfrom to speed up the compiling process.
  4. Under “Effects” make sure that the “Enable wind”, “Enable shadows”, and “Shadow maps” properties match your test conditions.
  5. Save the session and press “Compile” in the “Actions” group. The Compiler will then create all of the data necessary for rendering in the SDK in the output directory you selected.

This represents the bare minimum you need to do to get a tree model compiled. There are many other options to tweak and tune in the Compiler such as shader LOD, texture scaling, billboard generation, etc.

Step 3: Run the Reference Application

The SpeedTree Reference Application (Ref App) is designed to show tree models rendered using the SDK on a number of different platforms in a sample environment. The goal for this test is to replace the tree models in one of our sample forests with tree models of your creation. By doing that we'll skip over creating terrains and skys that only work in the Ref App and focus on the tree models that will render in any environment where the SpeedTree SDK has been integrated. Please take the following steps to see the tree modeled and compiled in Steps 1 & 2 running in the Ref App.

  1. Run the Ref App launcher. It is installed with the SDK in the “Bin” folder (“Reference Application Launcher.exe”). Select the platform you chose in Step 2.
  2. Select any forest and right click it. Select “duplicate as…” to make a copy that you will edit and make sure the duplicate forest is selected.
  3. Make sure the “enabled” setting in the “wind” group matches what you entered in Step 2.
  4. Make sure the “enabled” and “num_maps” settings in the “shadow” group match what you entered in Step 2.
  5. You should see several configuration groups that add trees and grass. Comment out (using C++ style comments) or delete all tree and grass groups. Any groups labelled “swa_tree_population”, “grass_population”, “manual_tree_population”, or “random_tree_population” should be removed.
  6. Add a new group that will populate the scene randomly with tree model you just compiled. It should look something like this:
random_tree_population
{ 
    filename "OutputDirectoryFromStep2\Atlas\TreeModelFromStep2.srt"
    quantity 50
    slope_range 0 0.5 
}

Run the Ref App by pressing the “Run” button. You should see 50 instances of your tree model on the terrain. If any errors occurred they will be printed in the Ref App console.

Now that you have taken a tree through the pipeline you can experiment with different LOD distances, shader LOD settings, texture atlas sizes, and any of the many other settings designed to tune appearance and performance.