Contents

Forest Paint 2 User Guide

In this guide, i'm going to show you how to use the "Forest Paint 2" asset, what it can do, and how the basic workflow looks like.
The package also comes with an example terrain (the same terrain used in this guide).

If you have opened this Html document from the package, there might be a more recent version at https://www.danielpolish.hu/guides/forestpaint2.html.


Editor window

The editor window can be opened from Forest/Forest Paint

new painting

Page 1: Edit trees

Adding the component

The first page is where you will define different types of trees. These tree types will be available to be used as paint.
Most properties are shader properties, but some (the starred ones) affect how the mesh is going to be built. If you change these properties, the trees already placed won't change. They need to be repainted.

Properties:

Name You can name the tree types. In the tool, it's only used when displaying the statistics, but you might want to name the trees to differenciate them (if they use the same textures).
Side texture The side view texture of the tree.
Side color This color is used to correct the textures, in case they don't match.
Top texture The top view texture of the tree.
Top color This color is used to correct the textures, in case they don't match.
Height The expected height of the tree.
Width The expected width of the tree.
Height variation The height of the trees are randomized.
The height of individual trees might diviate from the expected height with the magnitude of [this] (world space).
Width variation The width of individual trees might diviate from the expected width with the magnitude of [this] (world space).
Top billboard height The relative height of the top-view billboard. Zero means it's at the bottom of the tree, one means it's at the top.
Side-Top change angle When the depression angle of the camera is below this value (in degrees), the top-view billboard will not be rendered.
Facing direction change distance When the camera is far away from a tree, it is going to be facing towards the camera.
If the camera is close enough to the tree (not further then [this]), it's going to be facing in the opposite direction the camera is facing.
Transition start Facing direction will start transitioning, when the camera is closer than [this].
Ambient light Used for brightness correction.
Casts Shadows Wether the tree should cast shadows.
Supports Complex Lights A more advanced shader will be used if enabled. (with point and spotlight support) It's overhead for scenes with a single directional light.
Only supported on the Standard Render Pipeline.
Terrain shadow weight How much the trees are going to be darkened based on the dot product of the terrain normal and the ligth's forward direction.
Grayscale Zero means fully vibrant, one means grey.

Page 2: Paint trees

Tree painting UI

This is the painting screen. First you select the type of tree you want to paint, then the painting method.

There are three painting methods:

Fixed Density With this method, forests will have a fixed density, which can be set with the "Density" property.
Spraypaint With spraypaint, forests will gradually become more dense, the longer you paint over them.
Every time you paint, "Spray At Once" number of trees will be placed inside the brush. The algorithm will place the trees to the places which are the furthest away from all the other trees inside the brush.
Precise Place If you want to place a tree to where your cursor is, choose "Precise Place".

Regardless of the method choosen, holding down Shift will enable erease mode. If you hold down Control as well as Shift, only trees of the selected type will be removed.

Painting and ereasing can be undone / redone, by using the Undo / Redo buttons.

With paint method "Fixed Density" and "Spraypaint", the projection mode can aso be set. It tells the algorithm from where the calculated positions should be projected onto the terrain.

Straight down The positions will be projected straight down.
Terrain normal The positions will be projected parallel to the terrain normal (at the center of the brush).
Camera forward The positions will be projected parallel to the camera's view direction.

Page 3: Statistics

statistics

If you want to know how many trees you have painted, switch over to the "Statistics" tab.
You can see the number of placed trees, vertices and triangles, broken down to each type and combined.

Setting up the tool

First you need to create a new painting or choose an existing one.

new painting

Upon creating a new painting, you will be asked to assign a transform to the "Relative to" property.

relative to

The mesh (positions, normals) is going to be generated relative to this object, and this object is going to contain the forest as a child object. Upon assigning, a "Painting Container" script will be attached to the game object. All this script does is that it has an array of paitning IDs. When loading a painting, it's going to look for a "Painting Container" component, which has the painting registered.

billboards

After this, it's time to define some tree types. Theese types are going to be available to paint. You can create a new tree, by clicking "Add".

The trees are billboard trees. Each tree consists of two billboards. One for the top-view and one for the side-view. The side-view is going to be facing either towards the camera, or in the opposite direction the camera is facing (depends on how far the camera is). However, trees won't pitch, instead, if the depression angle of the camera is beyond a cretain limit ("Side-Top change angle"), the top-view billboard is going te be rendered as well.

billboards

For every type of tree, a material is generated. Theese materials are saved to ForestPaint2/Materials/

painting.xml

The tool uses an XML document to keep track of every tree in the painting. This is what you need to assign to the "Edited Painting" field in the editor window. This document contains the uris of the meshes and a list of the placed trees. It's only necessary for editing. If the painting is done and you don't want to modify it, this document might be deleted / moved.

painting.xml

As of Unity 2019.3, text assets are handled differently, and they look like this:

painting.xml

Painting

Once the trees had been set up, we can start painting.
Select the method you want to paint with, then press "Start Painting". You can paint using the left mouse button. To erease trees, hold down shift (before you press the left mouse button). To only erease trees from the selected type, also hold control.

painting

After having painted a few trees, you might want to go back to the tree editing tab, to fine-tune some properties (height, side-top change angle, correction colors, ect.).

With spraypaint, tree types can also be mixed. (Painted separately, but they will be nicely spaced.)

painting

The painting is saved after every brush stroke.

Unlike in Forest Paint 1, you can paint over multiple objects.

paint over multiple object

When painting, the tool constantly builds meshes. The bigger the mesh, the slower it is to append a tree to it. For optimal preformance, a mesh can only hold up to 1500 trees (12000 vertices). When the vertex count reaches this limit, a new mesh will be added to the painting. New trees are going to be added to the mesh with the lowest ID, which isn't full yet.
The meshes are saved to ForestPaint2/Paintings/[ID]/meshes/

meshes

And that's pretty much it!

done done final

Forest Paint 2 User Guide