Nerd For Tech
Published in

Nerd For Tech

Getting Started with Terrain Tools in Unity Part 2: Textures and Trees

Now that the landscape mesh has been sculpted, we can start painting textures and trees into the scene!

In my last article, I left off with this sculpted game scene that is just a base mesh with no color or texture. Let’s go ahead and spice this up.

Textures

Head to the Paintbrush tool and select the Paint Texture option.

You won’t be able to paint any textures until adding a Layer to your Palette. Press the Add Layer button.

If you installed the basic Unity Terrain Tools, you should see a few options for textures to paint on to your landscape. Let’s start with some dirt.

The entire terrain becomes covered in the dirt texture.

The Layers dropdown shows the dirt texture, as well as options to add or remove texture layers.

The Layer Properties shows that the dirt texture is basically a material, in the way that is takes Normal and Mask maps, has a Color Tint option, and some very handy Tiling Settings.

Reducing the Size in Tiling Settings on the dirt texture will reduce the size of the texture being reproduced, making it appear with more fine details. That already looks a lot better with a smaller tiling size.

I add another Layer and choose the sand texture.

You can use the brush tools and paint the sand right on to the landscape in the same way that we sculpted it in my last article. Using a lower brush strength will give more blending between textures.

Using an overhead view is a quick and easy way to make large brush strokes with different textures.

More texture layers are added for moss, scree, rock and snow.

For reference, when you paint different textures on to the surface of the landscape, the information stores in a Splat Alpha.

Let’s keep at it by adding small amounts of scree, mostly at the base of the mountains. That gives some nice rubble texture as the ground meets the mountain.

The rock texture is great for painting the mountains. The large cracks are just the rock texture and not sculpted into the mesh!

The snow texture can be used to finish the highest peaks. I honestly didn’t take very much time with the snow or anything else, as I am mainly running through the tools. If you take your time with the sculpture and texture application, you can get some really nice looking mountains.

Looks lonely out there little capsule.

Trees

There are some amazing environmental asset packs out there, but for this article I will be using Unity’s Standard Assets (free).

This is a large pack of assets and animations to say the least, so for now I only import the Environment portion of the asset pack.

The imported assets will appear in the Project folder under Standard Assets>Environment. The SpeedTree asset will be the featured trees for this article.

Select the Tree brush to start painting trees!

Similar to the textures, we need to press Edit Trees>Add Tree before we have any trees to paint with.

Press the circle/target icon on the Tree Prefab assignment box to bring up available tree options. I am will be using the Broadleaf and Conifer Desktop tree assets. There are mobile options for both if you are building for a mobile platform.

The two trees have been added, but because I am using the HDRP in Unity, I have more steps to take. If you are using the URP or the Standard RP, your trees should be good to go out of the box. Feel free to scroll down to the Placing Trees content.

Upgrading Materials to HDRP

This hot pink conifer silhouette tells me that I am using legacy shaders in the High Definition Render Pipeline. Let’s fix this up.

This Nature/Speed Tree Shader is not compatible with the HDRP, but changing the Shader type might disconnect all of my maps. There is a way to keep most of your assignments while upgrading these materials. Trying to auto-upgrade the materials doesn’t initially do anything here.

First, select all of the materials that need to be upgraded.

Then in the inspector, change the them all to the Standard Shader. This will lose an assignment to the mask map, but the albedo and normal maps should remain intact.

After accepting the changes to the Standard Shader, the materials can now be auto-upgraded to be compatible with the HDRP. Edit>RenderPipeline>HD Render Pipeline>Upgrade from Built-in Pipeline>Upgrade Selected Materials to High Definition Materials.

After the materials have been upgraded, the tree should now appear.

The new Shader is HDRP/Lit, but there is more work to be done here.

The leaves are big and blocky because they use an alpha channel to clip off the excess nasty visual.

Head back to the inspector and enable Alpha Clipping. The Threshold should be set to 0.33.

That’s much better. Now the leaves look more like needles without the extra polygon look.

There is still more to do though. Enable the Double-Sided option, then set the Normal Mode to mirror. This will apply the texture to the front and back of these leaves. Lastly, change the Material Type to Translucent. Now more light will show through the leaves.

That’s a much better looking conifer tree.

I run the same steps for the broadleaf tree and now they both appear ready to grow their numbers.

Placing Trees

You can paint a tree one or a few at a time with the brush tool, just select which tree you want to place. The Brush Size and Tree Density will dictate how many trees you are painting at once. You can quickly populate this quarter million acre terrain by pressing the Mass Place Trees button.

The Place Trees window let’s you tell it how many trees you want placed around the landscape, as well as an option to keep your existing trees.

In no time at all, trees have grown to take over the landscape.

To remove a tree, select the type of tree you want to remove in the brush panel, then press and hold the shift key and left-click on it.

Now there are a lot of trees, but also a lot of dark cast shadows.

In the directional sun light, expand the gear options to reveal the Dimmer slider. Lowering this value will reduce the darkness of the cast shadows.

I also removed some excess trees from the path to allow light through, but also let the player know what direction to travel in.

Remember when I said the HDRP transition may disconnect the mask map? Let’s reattach a few to get more depth out of these leaves.

Now there is more color variation giving texture and depth to the leaves.

I reassign a map to the Broadleaf branch material to bring out some more texture in the bark.

I also increased the normal maps on the bark textures a little to give them more depth.

Painting Details

Unfortunately, if you are using the HDRP like I am, Painting Details is not yet supported. I will still run through the process, but I won’t be able to actually show any painted details in this walkthrough. Anyways, start by selecting the Flower Brush.

Press the Edit Details button and select Add Grass Texture. These are 2D billboards that always face the camera, which involve much less processing power than the equivalent amount of 3D objects would require.

You can play with a lot of options before you start painting. The healthy and dry color options make for some great looking grass.

Click on the Detail Texture to look for available grass assets. Type grass in the search field to find them.

This is where I would start painting grass on the the landscape if using the brush tools if I wasn’t using the HDRP. I will make another article covering this feature in the URP for reference.

You can also paint in 3D grass prefabs, which can really add a lot of depth to your game scene. These take up more processing, so it’s good to try and keep them in areas closer to where the player will be travelling. These are also great for covering up the areas where tree trunks meet the ground. Press the Edit Details button again only this time choosing the Add Detail Mesh option.

Because the detail mesh is not supported in the HDRP yet, I resort to hand placing some grass prefabs around the environment.

These grass prefabs are from the Filebase asset library by GameDevHQ.

Filebase also has these nice daisy flowers available.

I think for a quickly put together scene, this is looking pretty good!

Such a nice day to go for a walk in the woods.

Maybe there is a relaxing beach over the mountains.

Here is a short in game gif of the player moving through the terrain.

You can do a lot to your scene with a little post processing. Here I added a global volume with a lot of volumetric fog. I also added in some film grain, a vignette and a touch of chromatic aberration.

The scene is now a bit more creepy.

Let’s take a short stroll through the forest.

Those high peaks look too dangerous to be hiking on.

I will stick to the path here and see what lies beyond.

I will revisit this series with part 3 using the URP to cover the missed areas like detail painting, water prefabs and wind zones. Thanks for reading along!

--

--

--

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Recommended from Medium

Dart Basics (Part-1: Futures)

Recursion

When to use Abstract Class in c#?

Crash course on CAD data. Part 5

Fig. 1. Elements of the product structure typically carry meaningful names

Pseudo-code, What is it & Why should you use it?

How to Configure AWS Lambda to assume a role from different account ?

PEP8 Takeaways for Machine Learning and Notebooks

Planning Right for Your SaaS Solution

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jared Amlin

Jared Amlin

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

More from Medium

Getting Started with Terrain Tools in Unity Part 3: Details, Wind and Water

How to get GIT Bash for Unity

Journal 146 — Unity Project Development, 2.5D Shooter

More Productive Editor Layout in Unity