Now that we've covered the basic structural components of the Mantle Core and Theme, we get to the component you'll be spending most of your time with if you're creating a custom Theme; the Mantle Style. Styles are where most of the magic happens and give you flexibility and control over how each element is generated in 3D.
Other related posts in this series cover:
Once you have arranged and organised your preferred environment layers you can then begin to breathe life into them by adding assets to get the look you’re going for. Styling enables you to add materials, shaders, textures, and objects (in the form of prefabs). Styles are how you use your imagination to bring your world to life by defining how each part of your environment will appear in the scene using your assets.
There are three types of Styles:
- Basic Style: Used for land use areas, water and earth
It supports Materials, Terrain fill and Terrain edge
- Building Style: Used exclusively to style buildings
It supports Materials, Terrain fill, Terrain edge, and Cladding
- Transport Style: Used exclusively to style transport routes
It supports Materials, and Transport Edging
We're covering the Basic style in this post and will follow up with Building and Transport style posts of their own.
As you can see the various types of style share some core features as really they all do very similar things with some specific options for buildings and transport. Let's talk about each aspect of a style in more detail.
Materials settings allows you to add colour, texture maps and supported shader materials.
There are two main retrial texturing bodies in the style setting. Top and side materials. Each consist of a main and secondary material option. Top material enables you to texture the top surface of the environment area created by this style. Side material will texture where a side height has been applied. These are mainly seen on earth, land use and road layers.
Want to choose randomly from various materials during generation?
You can add multiple material slots which Mantle will then randomly apply from the material options if there is more than one material slot.
The Main material is a consistent and general option for texturing the surface of any environment layer. Secondary material allows a shader to be applied that can add vegetation or other geometry based shading. Whenever a 3D shader is applied it will usually require a base material and so the main material option serves this purpose.
Also within the material settings is the ability to control how your textures are tiled. There are four tiling options:
- Tile based
- Stretch to corners
- Height dominant at angle
- Longest Edge tile based
Tile based works as a standard 1 unit x 1 unit tile.
Stretch to corners will stretch your single texture to fit the corners of the mesh surface.
Height dominant at angle ... first person to tell us what this is gets a free copy!
Longest Edge tile based works similar to tile based however there is a noticeable difference. Normal UV tiling is always aligned with the world coordinates so you will notice that your textures are often tiled diagonally or offset to the object x/z alignment. Selecting longest edge tile based will tile your texture using the longest edge of your mesh as an orientation reference. This way, the texture appears correctly aligned relative to each object surface that is using it. Generally roof materials and textures for pitches and car parks are the most noticeably affected by this.
Finally, within the Material settings in Mantle style is the Minimum and Maximum side height option.
Note that currently all terrain in Mantle is effectively 2D plates stacked in 3 dimensions. We're working on a major new terrain feature that will add a significant alternative here and may render this obsolete in the near future.
This is one of the ways to add depth to areas created by a style in the environment. If none is set, all layers will appear flat; think sheets of paper laid on top of each other. However you can adjust the side option to any height you choose. When the minimum and the maximum heights have the same number, the height will be even. When there is a substantial difference between and minimum and the maximum, Mantle will randomly raise each generated land use using this style to different heights. In this way you can create environments that have 3D capability to raise earth away from water and stack areas like grass on top of earth.
Across all layers, every environment element has a surface. By placing objects on and around the surface you can transform your scene dramatically. This is where the all-important Terrain fill and Terrain edge feature come in.
It's worth noting that Mantle places objects based on the dimensions of their attached Physics Collider component. This provides a placement system that at its most basic setting creates believable areas where objects don't stack together in the same space. It also means that if you choose you can create interesting object placement simply by manipulating the size and location of the Collider component. For example if you want trees with roots to be buried slightly below the element surface or if you want objects to be able to stack through each other at very close proximity.
A style's Terrain fill allows you to dynamically place prefab objects over the element surface generated by this style. By adding prefab object slots to the terrain fill you can set as many objects as you like to populate the surface, each with their own placement rules.
This is an incredibly powerful feature and brings environments to life very quickly with even just a few objects.
Mantle also provides a Bypass small areas filter for terrain fill placement which allows ignoring element areas below a minimum area. For example, you may choose to bypass all surface areas less than 100sqm. This will increase render speed as Mantle will not attempt to populate areas below that value.
Similar to Terrain fill Terrain Edge allows procedural placement of objects along the edges of element areas. Edges allow creation of fences for enclosed areas or, in the case of transport, street furniture and other decorations. You can easily control the distance between placed assets, size variation per placed asset, valid terrain layers the asset can be placed on via On Terrain, how close they are placed from the edge, and a selection of rotation types.
So go on! Now that you've got the basics, start creating your own Theme.
Check out the Building and Transport Style posts for a more detailed look at each of these specialised styles.