Monday, 14 December 2015

How we handle terrain dressing


Terrain dressing is what we call the sprites which appear on the surface of the terrains where the cars can drive.



We create groups of terrain dressing objects, for instance one group for trees, one for bushes, one for foregroud bushes. These are stored in a .asset ScriptableObject database.
Each group contains a lot of parameters which determine how the dressing is generated.
These include horizontal spacing, offset ranges in Z (to create parallax) or Y (clouds, for instance), and scale ranges.
There's also a Max Slope Angle which determines what slope the objects should appear on. We don't want trees on steep slopes, but bushes can go there fine.


Added on to this is a script which is called per-object. I derive classes from a base Dressing Base script. When being placed, all DressingBase scripts are called in the object's hierarchy.


The two in use here are DressingPlacement and DressingColor.
DressingPlacement decides whether the object should take the angle of the surface (eg. for bushes) or not (eg. for trees). Also there's a random range which is added to the rotation of the object.
DressingColor simply modifies the color of various parts of the object randomly for variety.

When AutoUpdate is set on the terrain script, we can adjust the variables in the groups database and see the result in realtime in the editor.

Once we have a set of groups in place, and have decided how we want the particular game to look, we can duplicate the groups for other types of terrain.

Here we have 3 more terrains which are basically the same as the first one we made, with a few groups duplicated and modified:





Visit our Facebook page for the latest updates!



No comments:

Post a Comment