In this brief tutorial, I'll show you how to start setting up Landscape for use as terrain for environments. Before I start, though, I'd like to point out that there is a ton of useful info on the UDK help pages.
Here are some relevant links:
http://udn.epicgames.com/Three/Landscape.htmlhttp://udn.epicgames.com/Three/LandscapeMaterials.htmlhttp://udn.epicgames.com/Three/LandscapeEditing.htmlhttp://udn.epicgames.com/Three/LandscapeCreating.html
This tutorial is going to distill the info in those pages down to the essentials to get you started with Landscape.
This WILL NOT be an in-depth tutorial.
If you want specific numbers and info on things not covered in this tutorial, go read those pages. There's a lot of info in them.
GETTING STARTED
The first thing you should know about Landscape is that it is a completely separate tool from Terrain, UDK's previous ground mesh creation tool. Terrain has a lot of useful tools, but the way it handles materials is a little bit clumsy and it doesn't take advantage of some of the polygon-pushing power that UDK now offers.
Landscape is compatible with DirectX 11 hardware tessellation and offers a very different but much more powerful material editing system (SPOILER ALERT: It's the material editor.). I'll outline a basic way to take advantage of this material editing system in my next post.
So, let's take a look at how to start working with Landscape.
In a new map, click on the Landscape button under Modes.
This should cause the Landscape Edit window to pop up.
We want to create a new Landscape, so scroll down to the section called Create New.
We're not importing a heightmap for this tutorial, so don't worry about that section. What we're worried about is Heightmap Size. Because of the somewhat complex way Landscape works under the hood, the numbers you're going to plug in here may look a little odd. There's an in-depth description of how it works here:
http://udn.epicgames.com/Three/LandscapeCreating.html
In the Heightmap Size section, we want to plug in some pretty small numbers since this is just a test to make sure we know what we're doing. In the Size (vertices) boxes, type 63 for both. In Component Size, select
63 quads and
4 sections per component. Now just click the Create Landscape button.
You should now have something that looks a bit like this:
That large checkerboarded plane is your Landscape. How cute! If you want to add some sort of lighting, such as a DominantDirectionalLight, that will help with sculpting the Landscape.
From here, sculpting your Landscape is very similar to sculpting Terrain. All the tools in the Landscape Edit window have tooltips telling you what they are and information about them is available in the links at the top of this post. If you wish to sculpt some bumps and such, you can do so by holding Ctrl and clicking, just as you would with the Terrain tool.
THE LANDSCAPE MATERIAL SYSTEM
In a nutshell, the Landscape material system is really just an extension of the Material Editor. To take advantage of possibilities this offers, you will need to create a material that has your ground textures in it. If you don't know how to create a material and put a couple of textures in it, then this tutorial is going to get a little too complex a little too quickly for you.
Drop your textures into a new material. Your material editor should look a little something like this right now.
For the purposes of this tutorial, I'll just be blending two textures. These textures are available in the August UDK. Their filenames are T_CobbleStone_D and T_Cobble_02_DL. I'll also be using their normal and displacement maps in the next post.
To blend these two textures together, you're going to need two nodes introduced with the Landscape system. These are
TerrainLayerWeight and
TerrainLayerCoords. The first puts your textures into layers so you can blend them and the second applies the textures to your Landscape UV coordinates. We're only going to need a single TerrainLayerCoords node and this will be plugged into our texture nodes. We will need two TerrainLayerWeight nodes, however, since we want to have one layer for each texture.
Plop two TerrainLayerWeight nodes and one TerrainLayerCoords in the material editor. Then plug them into your texture nodes like this:
Now, that's all fine and dandy. However, there's a problem that may not be immediately obvious. Each texture layer you'll want to paint onto your Landscape needs to have a unique name, but you're working with a single material that only has one name. How to overcome this obstacle? Click on the TerrainLayerWeight nodes and type in a unique name for each of them under Parameter Name. You're going to use these names in the Landscape Edit window in just a moment.
This is what your material should look like now. Note the names of the TerrainLayerWeight nodes have changed to reflect the names of the layers they'll be assigned to.
We're now finished with our very basic material and we need to apply it to our Landscape. Save your material and close the material editor.
To apply the material to the Landscape, select it in the Content Browser and then double-click on your Landscape in the main viewport. This should open the properties for the Landscape.
Under the Landscape rollout, click the green arrow next to Landscape Material and close the properties window.
NOTE: If your Landscape turns black in the viewport, DON'T PANIC. That means your material has been successfully applied.
Now, finally, we can get to the part everybody wants to see: Painting texture layers.
LANDSCAPE TEXTURE LAYERS
Open up the Landscape Edit window if it isn't already open and scroll to the section under the Editing rollout labeled Target Layer. In this section, you should see a brownish box with the words
Height map and an icon of displaced wireframe terrain. This is a texture layer, and it just happens to contain the height map for your Landscape, as opposed to a texture you'd want to paint color onto.
Notice the three Edit Modes you can select. For this tutorial, we need the one in the middle, Edit. Click the radio button next to Edit and it should change to look like this:
We're now going to add layers to paint onto the terrain. To do this, simply type in the name you entered for one of the TerrainLayerWeight nodes and press the
+ button to create the layer. Follow this same procedure for subsequent layers.
The Target layer section should now look something like this:
Now that you have a couple of layers, it's time to actually paint them onto the Landscape. Since the Landscape is totally black right now, it's a good idea to lay down a base using one of the layers so you can see what you're doing more easily. To do this, click on one of the new layers you created. It should be highlighted and the Height map layer should gray out. Now you can paint on the Landscape as you would if you were sculpting terrain by holding Ctrl and clicking and dragging.
Since you probably want to fill the entire Landscape with a texture, you should probably adjust the Brush Size, Tool Strength and Brush Falloff so that you can cover as much surface as possible and then click and drag on the Landscape. This should fill large portions with texture very quickly.
If you did everything correctly, you should have a Landscape that looks a bit like this:
Now that you have a texture applied to the Landscape, it's as easy as selecting the other texture layer and painting with it in the same way to achieve whatever look you want. The links at the beginning of this post have a wealth of information on how to use these tools in detail, so make sure that you read through them carefully if you have any questions about how to use Landscape and its texturing tools.
In my next post, I'll show you how to take advantage of the new material system that Landscape uses so that you can blend textures together in ways that were previously only possible on imported meshes. Vertex painting, bitches!
Replies
EDIT: Figured it out... The brush strength was defaulted at 0 for some reason. Derp.
I've tried using the same TerrainLayerWeight and TerrainLayerCoords blending mode material method described above, but it doesn't seem to work at all with normal maps?
The epic documentation is vague (and possibly outdated), the same setup works perfectly for specular and diffuse... I'm tearing my hair out.
Any help/advice appreciated
the same setup also works for the specular slot)
what I do basicly is this; I set up my spec and normal maps also with terrainlayerweight nodes, like the tutorial does with the diffuse maps.
I give these (layerweight-)nodes the same names as their difuse 'brothers'.
I noticed this works fine up to a set of 3 textures with each their spec and diffuse.
But from the moment I add a 4th one, the terrain texturing goes blank.
Is this because I hit the DX9 limit?
Or is there a better way to do what I am trying (so painting with diffuse, spec and normal maps for grass for example at the same time, instead of just diffuse grass)
cheers
Basically I'd like to know if it's possible to pull this kind of environment using landscape.
Where there is little or no elevation data but need for complex material transitions (blending diffuse/normal/spec elements of several different concrete tiles, soil, asphalt, grass) Or am I better off designing custom tile-sets and using vertex paint?
- Plain Gravel/dirt
- Larger, darker gravel under the tracks
- Grassy, weedy dirt
- Weedy, garbage-littered dirt
You could easily blend those together, and then cover the landscape with:
- Static meshes for the trains, tracks (modular), fences, poles etc
- Foliage meshes (for the overgrown grass)
- Garbage meshes (add some 3D clutter on top of your garbage texture)
I actually think the HARDEST part of the scene is going to be your skybox. Large, flat areas that fade to the horizon are tough, you need to believably obscure the void from the players view (and this scene doesn't call for very dense fog). You're gonna have a lot of work building background meshes (buildings, highways, etc) that obscure your horizon than the work involved in setting up your landscape textures.
What does everyone else think?
Are we just restricted to 1 terrain normal map?
Is anyone able to get more than 1 normal map to appear (or even better, blending normal maps?)
Thank you, that's not the actual landscape I'm going to attempt, only ground portion is similar. I'm aiming for this quality of blend, where both diffuse, normal and spec elements are correctly blended using custom mask or heightmap.
I manage to blend 3 layers with diffuse/spec and normal maps.
Check my image here; it shows my shader up to the breaking point.
what I show in the image works for me; but once I add a 4th texture, it goes wrong on its normal map.
This is the link for the image if it doesnt show here;
http://imageshack.us/photo/my-images/97/udklandscapepaintlimit2.jpg/
Regardless if it are diffuse/specular/normal maps.
I ran some tests and it all seems to point in that direction;
this explains also why it worked for me up to 3 diff/spec/nm (total of 9/12 texture samplers) and also with some other tests I did; it works also with 5 diffuse/normal maps if you drop the specular.
So whatever combo you make, with a maximum of 10 texture samplers seems to work.
cheers
I'm guessing if it is, we still might be able to use some normal map blending trickery to create some extra variation if we go above 9 unique texture samples?
Any word on when you'll address normals?
Thanks again!