Version: 5.3 (switch to 5.4b)
Деревья
Трава и другие детали

SpeedTree/LOD Trees

SpeedTree assets (.SPM files saved by Unity version of SpeedTree Modeler) are recognized and imported by Unity just like other assets. Make sure the textures are reachable in the project folder and materials for each LOD will be generated automatically. There are import settings when you select .SPM assets for you to tweak the generated game object and materials. Materials will not be generated again on reimporting, unless you hit the Generate Materials or Apply & Generate Materials button, therefore any customisations to the materials can be preserved.

The SpeedTree importer in the end generates a prefab with LODGroup component configured. The prefab can both be instantiated in a scene as a common prefab instance or be selected as a tree prototype on the terrain and paint massively. Additionally, terrain accepts any game object with an LODGroup component as a tree prototype, and put no limitation on the mesh size or number of materials being used (in contrast to the Tree Creator trees). But be aware that SpeedTree trees usually use 3–4 different materials, which results in a number of draw-calls being issued every frame, so you should try to avoid heavy use of LOD trees on platforms that are sensible to draw-call numbers.

How to make SpeedTree billboards that can cast and receive real-time shadows.

To make billboards cast shadows correctly, during the shadow caster pass, billboards are rotated to face the light direction (or light position in the case of point light) instead of facing the camera.

To enable these options, select the Billboard LOD level in the Inspector of a .spm asset, tick Cast Shadows or Receive Shadows in Billboard Options and hit Apply Prefab.

To change billboard shadow options of instantiated SpeedTree game objects, select the _Billboard object in the Hierarchy window, and tweak these options in the Inspector of the Billboard Renderer, just as you would with a normal Mesh Renderer.

Trees painted on the terrain will inherit billboard shadow options from the prefab.

You can use BillboardRenderer.shadowCastingMode and BillboardRenderer.receiveShadows to alter these options at runtime.

Known Issues: As with any other renderers, the receive shadows option has no effect while using deferred rendering, billboards will always receive shadows in deferred path.

Performance Improvements in 5.3

Billboard batching performance is improved in 5.3. Multiple cores are utilized for executing the dynamic batching code of billboards.

Batching logic is simplified. Now a batch draws one type of billboard because in real world cases billboards can hardly share one batch. Refer to SpeedTreeBillboard.shader for the change. If you have a customized billboard shader, depending on the previous behaviour you might need to amend your shaders.

Деревья
Трава и другие детали