User Tools

Site Tools


Importing Models into Unity

NOTICE: These instructions are applicable for Unity 5. SpeedTree will not work with earlier versions of Unity.

When you save a model in the Unity version of the Modeler you should have an .spm file that represents your model. This is the file you will import into the Unity Editor. The SpeedTree model will be imported into a normal static mesh object. Click here if you don't have an .spm file.

The first step in using a model you've created in the Modeler is to import it as an asset in your Unity project. To do this, simply use the “Save as…” option in the Modeler to save the model in your project's asset folder (or any of its subfolders).

Unity will recognize the files and launch an import process to add it to your project. During this process you may be prompted to fix normal maps if you are using them. Select “Fix now” and the import process will continue.

If you have purchased Unity tree models from the SpeedTree Store, you can simply unzip the downloaded file directly into your Unity project's 'Assets' folder.

Please Note: This above method is the most convenient way to import trees into Unity. If you right click on the Assets folder within Unity, you are presented with the option to “Import New Asset…” This will import the tree asset without its textures mapped. You will then have to manually add the texture map to the tree within Unity (something you've already done in the modeler).

When the model has been imported you have the following items in your project:

  • A tree asset corresponding to the .spm file you saved.

  • The atlas textures will be in the same folder as the “.spm” file.

  • Any tiling textures on the model (usually bark maps) will be in the folder as well.

A folder will be created with the same name of the model. This folder will have:

  • The billboard material.

  • A folder for each LOD. These folders will contain a material for each geometry type present in the LOD.

The tree asset object has the following options:

  • Re-generate Materials: When selected, new materials are created each time the tree is imported (e.g., asset level options are edited or the model is saved again from the SpeedTree Modeler).

  • Main Color: All generated materials are given this color as their main color.

  • Specular Color: All generated materials are given this color as their specular color.

  • Hue Color: All generated materials are given this color as their hue variation color.

  • Shininess: All generated materials are given this value as their shininess.

  • Alpha cutoff: All generated materials will use this value for alpha testing.

  • LOD: Use this control to edit where the LOD transitions will occur by dragging the borders between LODs left and right.

  • Enable smooth LOD: This option provides better LOD transitions (like those shown in the Modeler) at the expense of longer shaders.

  • CrossFade Width

  • Fade Out Width

All edits to the tree asset properties must be applied before being used. Doing so “reimports” the model so be sure to have “Re-generate Materials” set appropriately to avoid losing material edits.

Each material will have the appropriate textures assigned to it. The purpose of having a set of materials per LOD is to provide control over the rendering effects used at each LOD. For example, you may want to decrease the complexity of the wind at lower LODs to increase rendering performance.

The following section details the options available on the SpeedTree material.

SpeedTree Materials

Each SpeedTree material contains the following options:

Geometry Type

This option essentially sets which shader will be used for the rendering of this geometry. This option is automatically set during import and should rarely be modified. The options include:

  • Branch: Standard branches.

  • Branch Detail: Standard branches with a detail map applied.

  • Branch Blend: Branches with branch intersection blending enabled (this affect is tuned and enabled in the Modeler).

  • Frond: Used for palm fronds and image based branch detail.

  • Leaf: Standard leaf mesh geometry.

  • Facing Leaf: Leaf geometry that always faces the camera (e.g., leaf cards).

  • Mesh: Mesh geometry that is unaffected by wind.

  • Billboard: Used only for billboards and should only be set on the actual billboard material.

Wind Quality

Use this option to control the complexity of the wind shader. This option will be automatically set during import based on the settings in the Modeler (select the 'Fan' object then look for the property labelled 'Presets:Style') but can be tuned here for performance. It may be particularly useful to pick faster wind shaders for lower LOD materials to boost rendering performance. Wind quality options include:

  • None: No wind - this is fastest shader in all cases.

  • Fastest: Global motion only (the tree will rock back and forth but there is no independent leaf or branch motion).

  • Fast: Global motion plus leaf rippling (leaf mesh vertices oscillate based on wind strength).

  • Better: Global motion, independent branch motion, and leaf rippling.

  • Best: Global motion, independent branch motions, leaf rippling, and leaf tumbling (leaf meshes rotate in the wind).

  • Palm: This is a special mode for palm trees that includes frond rippling and palm-specific branch motion.

Base Texture Map

The texture map and tiling properties for the base texture layer.

Normal Map

The normal map and tiling properties for the normal map layer.

Detail Map (optional)

The texture map and tiling properties for the detail map layer, if it exists (branches only).

Hue Variation & Color

When enabled, the main color used for the material will be randomly driven toward this color based on its position in the scene. The maximum amount it will be driven to the chosen color is governed by the alpha value of the color. Use this feature (particularly on leaves) to vary the colors of each instance of tree model. When combined with random rotations and scales, this effect helps add variance to the scene while still using a small number of unique tree models.

AO

Use this option to toggle ambient occlusion on the material. Ambient occlusion is precomputed in the Modeler and saved per-vertex in the geometry. You must compute ambient occlusion in the Modeler prior to saving the tree for this effect to work. See the full SpeedTree docs for information on how to fine tune this effect in the Modeler.

Main Color

The color of the material.

Specular Color

The specular color of the material.

Shininess

The shininess of the specular effect.

Alpha Test Reference Value

Alpha values below this level will be discarded.