This tutorial covers the creation of a world building data file.
|NOTE: Only available in SpeedTree for Games and SpeedTree Cinema.|
Follow these steps to setup and export a complete forest of tree locations:
1. Obtain terrain data in mesh format (FBX, OBJ, or STM) and import it into the Modeler as a mesh asset. It is important to work in the same units and measurements that your end application uses in order to maintain a perfect match between the apps.
2. SpeedTree for Games Only: If you are using the SpeedTree SDK / Reference Application as your target app, you'll want to orient your mesh so that it is positioned in quadrant 1 (+X, +Y). Make sure the mapping on the mesh is such that the corner at the scene origin has texture coordinates of [0,0]. Set the pivot of the mesh at the origin as well.
3. Add a default zone generator into a new scene from the “+” button on the Generation Editor toolbar. This can also be accomplished via the right-click menu in the Generation Editor.
|A “default” zone is just a disc.|
4. In the zone's properties, go to the “Meshes” group and Enable meshes. Then, assign the imported terrain mesh to the first Geometry property. If desired, import a texture as a new material asset and apply it to the terrain by dragging it onto the zone mesh in the 'Tree Window'.
5. Set the Use actual size and Place at origin options to ensure that the terrain mesh is oriented to its identity matrix.
|A shortcut for this setup is available as a template. Right-click on the Tree Generator and select the menu item “Add template to selected→Zones→Terrain”. Then, simply add the mesh asset to the zone.|
6. Add a proxy generator as a child of the zone generator. Proxies by default are simply non-descript spikes. These spikes can be replaced with mesh assets, which could be the actual geometry used in your end application, or simplified versions of the actual production geometry. Spikes can be set to override the display of actual mesh assets via a degradation setting.
SRT Files (if using the SpeedTree SDK) - If you haven't created your run-time tree models yet, do so now. Simply select the trees for your scene from within the SpeedTree Compiler and generate SRT output files and billboard atlases for each. Use the generated billboard atlas as the material assigned to each SRT file in your world building setup. ^||
7. Revisit your terrain zone and set up the growth parameters as necessary. Be sure to look into the settings for Area influence, Surface adhesion, Influence of forces, and Adapt to masks. Detailed info on these settings can be found in the help section linked below the following image, or watch a time lapse video to see them in action:
8. If needed, assign a mask asset or a series of mask assets to the proxy generator. Masks are applied in the “Generation” property group of the proxy generator, and can be stacked on top of each other; for instance, you could use a black and white image to mask off the “water” regions of your terrain, then use a “Terrain” mask to remove trees from steep faces.
9. Use proxy collision detection to cull overlapping proxies. To enable collision detection, go to the Tree Generator properties and press the Cull button under “Proxy Collision” or enable Automatic proxy collision detection. Press the Restore culled button to go back to the pre-culled state.
SpeedTree for Games Only: For best results, perform proxy collision detection on SRT files – it will use the actual collision volumes found in the real-time tree models.
|(left) before collision detection, (right) after collision detection|
10. Node edit the X,Y, or Z position of any individual proxy node, or delete individual proxy nodes altogether. The alignment, size, or mesh assignment can be changed per node as well.
11. Export a world building file from the menu item “File→Export world building data”. If you would like to tile the forest results for a repeating terrain, type in the number of tile iterations to include.
SpeedTree for Games Only: If you are using SRT files as meshes, select “Mesh asset filename” as the object name source.
12. Your world building exercise is complete! To use the exported tree location data, import the SWA/STF file into either the SpeedTree Reference Application, your real-time engine of choice, or import the results into a variety of third party 3D rendering packages via our included import scripts.
|(left) high detail models positioned in 3ds Max from SWA File, (right) rendered image from same data.|