Speedtree

From ARK Modding Wiki
Jump to navigation Jump to search

Original Source

Checklist

If you read nothing else on this page... read this and use it!

COLLISION

  • Create simplified collision only on harvestable trees (not bushes)
  • UE4 StaticMesh Editor: Disable collision on leaf and frond materials.

DRAW CALLS

  • All branches use the same material
  • Disable branch seam blending

LIGHTING

  • Proper volumetric foliage normals on fronds / leaves

LODs

  • Create at least 3 geometric LODs
  • Lowest detail geometric LOD < 500 verts
  • UE4 StaticMesh Editor: Configure proper LOD distance settings
  • UE4 StaticMesh Editor: Enable Allow Distance Field Texture on trees only

MODELING

  • Trunk and branch geometry density is enough to look great close up, especially near the bottom of the tree.
  • Trunk is capped on the bottom.
  • Normals are not inverted (check backface culling)
  • Wind is generated using Quality and Breezy
  • Run SpeedTree Compiler to optimize texture atlases and minimize empty space in billboard geometry (and save settings to disk for future use).
  • Final LOD should match closely to the look of the billboard, to avoid an obvious transition.
  • Final Billboards should be 2048x2048 and set to NoMipMaps in engine.

MATERIALS

  • Mip map generation settings on billboard textures should be set to "NoMipmaps".
  • UE4 Material Editor: Do not use Two-Sided materials for opaque surfaces like trunks and branches.
  • UE4 Material Editor: Wind enabled on MICs for leaves, fronds, and branches.

Modeler

Organization

Assets should be organized in the asset repository according to a common setup. For a given asset, files associated with the SpeedTree Modeler (source textures, custom meshes, the .spm file, etc.) should be stored in a "Source" subfolder. Files associated with the SpeedTree Compiler (atlased and engine-ready textures, the compiler .scs file, and the compiled .srt file) should be stored in a "Compiled" subfolder.

OrganizationSpeedtree.png

Trunk and Branch Geometry

It is very important that the portion of trees the player can get close to has an adequate amount of geometry to support dynamic tessellation for displacement. Tree trunks should never look polygonal. In general, the geometry can be reduced in LOD1 and LOD2 as much as needed for performance.

The Length value under Segments controls how many edge loops a trunk or branch node has, and the yellow curves editor to the right of it controls how those segments are distributed along the node. Segments should not be distributed uniformly unless the tree isn't much bigger than the player; rather, geometry should be most complex at eye-level and fall off smoothly above that, as shown below. If a trunk or branch includes sharp bends and splits, you should push segments towards those features and lower the number of segments where the element is straight.

Treetut4.jpg


(Radial segments may be reduced over the length of the trunk/branch as well, but should not be reduced as quickly.)

Trunk bottoms and branch tips should be closed off *without* using cap geometry, which generates unnecessary draw calls. Under the Branch settings, use the blue curve editor to reduce the branch or trunk radius to 0 where appropriate. You may need to add additional length segments and push them towards the capped areas to avoid a polygonal look.

Treetut3.jpg


(This trunk is capped by reducing the radius to 0 at the ends, but more length segments are needed to smooth the cap out.)

Foliage Normals

Leaves and fronds must have their vertex normals adjusted in order to be lit correctly. Generally, clumps of leaves should be treated as a single "blob" and have their normals adjusted to point outward from the center of the blob, with a slight bias upward. Frond-type foliage normals should more closely reflect the geometry of individual fronds, but may need to be tweaked if adjacent fronds are being lit inconsistently.

Treetut1.jpg


(Left: good normals, with some local blobbiness but a smooth transition across the tree. Right: bad card-oriented normals)


SpeedTree has separate controls for tweaking normals on leaf and frond nodes, shown below.

Treetut2.jpg


The most significant difference is that frond normals will be derived from the vertex normals of the frond geometry, while leaf normals are derived from local and global "anchor points" (viewable as orange dots in Realistic rendering mode with Hints turned on). You should take this into account when modeling frond geometry in an external application (consider biasing the normals before bringing the geo into SpeedTree if you know how they'll be placed on the tree beforehand, i.e. with a palm tree).

Detailed information on what each control does can be found in the SpeedTree documentation.

LODs

LOD1 and LOD2 are progressively simplified versions of the base tree, created using the LOD tools in the SpeedTree Modeler. The silhouette of each LOD should be as similar as possible to the base tree so that transitions between LOD levels are not jarring.

LOD3 is the billboard. Special care should be taken to ensure the billboard matches LOD2 as closely as possible. It may also be necessary to adjust the billboard texture in editor to more closely match the hue and value of the LOD2 tree.

Collision

CollisionTree.jpg

Use collision primitives only where the player might collide with the asset. Try to use only one collision primitive if at all possible.

Wind

Wind.jpg
Wind2.jpg

Use the Wind Wizard in SpeedTree to generate appropriate wind for the tree using Breezy conditions and favoring Quality.

SpeedTree Compiler

Compiler Atlas Scale.jpg

Use SpeedTree compiler to create an optimized texture atlas for your tree.

Compiler BillBoards Cutout.jpg


Optimize the billboard geometry to minimize the amount of empty space. For export, make sure to set tree billboards to 2048x2048 so they look best in Unreal.

Unreal Editor

StaticMesh Settings

StaticMesh Editor.jpg

In Unreal, set proper LOD settings for SpeedTree assets, including Screen Size and disabling collision on all leaf materials. Check Allow Distance Field Texture for trees and large bushes, but not very small plants.

Material Editor

Create new Material Instance Constants that are children of the master Foliage materials:

Material'/Game/PrimalEarth/CoreMaterials/MasterMaterials/MM_Foliage_Trunk.MM_Foliage_Trunk' and Material'/Game/PrimalEarth/CoreMaterials/MasterMaterials/MM_Foliage_Leaves.MM_Foliage_Leaves'

Unreal automatically creates materials whenever a SpeedTree is created, but they should not be used.

Textures

Diffuse, Material Attributes, Normal Displacement
KapokTextures.jpg
KapokDisplacementMap.jpg


Diffuse, Material Attributes, and Normal

These three textures should follow the physically-based texture guidelines defined on the Materials & Texturing page. Because we get so close to trees in ARK, the minimum pixel width of trunk textures should be 1024. For some larger trees, a 2048 pixel width may be necessary.

Displacement

One of the most critical elements in high quality trees is the use of a displacement map to add extra geometry detail when the camera gets close. In ARK, the player will be looking closely at trees quite a lot! Compare the images below.

TrunkDisplacement.jpg


A good displacement map does not have high-frequency detail, because this cannot be represented well in the engine. The displacement map used above is close to the detail limit. It is 1/4 the resolution of the other textures in the material.

Billboards

Tree billboards should be 2048x2048 and set to NoMipMaps. There is a weird streaming calculation that causes them to become blurry before they should, so this enforces the look we want.

Gameplay Setup

General Tree Setup

These are the basic steps for setting up new Trees to be gameplay ready. Note that this setup makes the assets ready for gameplay, but further adjustments may be needed to their harvesting components or impact emitters to suit gameplay later down the line:

Tree Settings (In the SM_Settings file):

  • Replicate this Component: True
  • Damage FX Actor To Spawn: TreeHarvestImpactEmitter
  • AttachedComponentClass: WoodHarvestComponent
  • Destroyed Mesh: None
  • Destroyed Mesh Actor Class: TreeFalling_Blueprint
  • IsFallingTree:True
  • Override Destruction Materials: See below
  • Start Cull Distance: 0
  • End Cull Distance: 0
  • Low End Start Cull Distance: 150000
  • Low End End Cull Distance: 200000
  • Collision Preset: BlockAllExceptIK
  • Recieves Decals = True.

Override Destruction Material Creation

  1. Create Material Instance Component from any elements listed in the LOD0 inside the StaticMesh actor for the tree. (Such as Trunk or Leaves)
  2. Rename new MICs to have _Fade on the end of them.
  3. Set new MICs to have Dissolve=True.
  4. Set up Override Destruction Materials to EXACTLY match the order of the elements listed in LOD0 in the StaticMesh Actor.

General Harvestable Bush/Object Setup

These are the harvestable bushes/pickable bushes/small plants/etc which can be activated by the player to collect resources. As with the trees above, some modifications may need to be made afterwards by a designer, but this will make them gameplay ready.

Pickable Plants (In the _SM_Settings file):

  • Replicate this Component: True
  • Damage FX Actor To Spawn: None
  • AttachedComponentClass: SeedHarvestComponent
  • Destroyed Mesh: See below
  • Destroyed Mesh Actor Class: DestroyedMeshBase_IgnoreSelf
  • IsFallingTree:False
  • Override Destruction Materials: None
  • Start Cull Distance: 15000
  • End Cull Distance: 20000
  • Low End Start Cull Distance: 0
  • Low End End Cull Distance: 0
  • Collision Preset: No Collision.
  • Recieves Decals = False.

Destruction Mesh Creation

Destroyed Meshes should be carefully generated as follows:

  1. Set LOD0 of the StaticMesh you are making a DM of to 5% polys in the LOD settings (requires Simplygon - otherwise use a manually-created simpler version).
  2. Save, generate the Destroyed Mesh.
  3. Set Cell Site Count to 10-20 (Depends on size and whatever looks good, larger things, more pieces.)
  4. Fracture Mesh.
  5. Save DM.
  6. Make SURE the StaticMesh is set back to 100% Polys on LOD1 and SAVED.
  7. Specify the new Destroyed Mesh in the Harvest Settings (above).