Building natural environments in Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

I'd love to see how UE4 (or UE5 next year) stacks up against whatever Ubisoft have internally (vs the FarCry5 editor from 2018), or what changes they've been able to make when they get to a 'full' next-gen title.

👍︎︎ 12 👤︎︎ u/Anxious-Dare 📅︎︎ Jun 03 2020 🗫︎ replies
Captions
>>Paulo: Hi, everyone. My name is Paulo Souza and I am the Unreal Engine Evangelist for Brazil and Latin America. Today we're going to present some features and techniques that can help you create natural looking environments with the Unreal Engine 4. We're going to work on this scene, covering the usage of the new Landmass plugin, like the Landscape Edit Layer system and the uses of Landscape Blueprint brushes. We're also showing some techniques that can help you create interesting blending effects using runtime virtual textures. To wrap it up, we're also touching established functionality like the Procedural Foliage Placement and the Procedural Grass System to create this natural looking vegetation you're seeing on your screen. Before we start, let's first make sure that we have the Landmass plugin enabled. Go to settings, plugins, look for Landmass. After you enable that, the Engine will probably ask to be restarted. Let's now first grade our landscape. Go into the landscape mode by clicking this button or pressing shift 3 on your keyboard. As you can see here, we have a material that we have previously made with a few landscaped material layers applied. That will save us some time during this demo. Make sure that the new edit layers functionality is enabled and press create. The Blueprint Custom Brushes system exposes full landscape control to Blueprints. It allows custom brushes to be created that can affect the landscape in a non-destructive way. Is important to remember that landscapes are simply dynamically generated geometry that reads a height map where each pixel is used to store elevation data. Blueprint Custom Brushes allow developers to create their own approach to landscape sculpting by making use of the GPU to overlay render targets that are going to be baked into the height map texture. For this demo, we're going to use the built-in examples in Landmass plugin that developers can use as a reference to expand on it. So let's first start by creating our Landscape Blueprint brush. Going to the sculpting tools mode, Blueprint brushes, and we're going to select one of these. I'm going to start with Landmass. Here we can start customizing our brush. We could probably change the falloff angle or we could cap the shape so we can create a plateau like terrain or canyon like terrain. We're not going to touch this now. We want to make mountain [INAUDIBLE] So I'm going to add some randomness to this form. First I'm going to scale that up a little and make it slightly bigger because it's going to be a mountain. I'm going to add some randomness to it using the curl noise feature. We already have it mountain like looking-- It adds this really nice randomness to it. We can play with it a little. Pretty good. We're going to smooth the corners, adding 1,000 units so we have like smooth corners here. And don't forget that this is all possible because our Custom Brush Landmass template, we're using sign distance fields to generate the height map that we're going to, you know, overlay the render target up to height map of the landscape. Developers like you can use whatever technique you want. We're using distance fields because this is very useful and very powerful and we can customize it in many ways using our shaders. Going on, a very interesting aspect of the custom brush-- custom Landmass brush-- is that not only you can affect the height map, but you can also paint material layers. You can paint the landscape layers. So we're going to add a new paint layer target segment. I'm going to use the rocks layer that was previously configured in our material. I'm going to play with it in a little then increase the falloff. It adds this really nice transition. I'm going to decrease the offset to 1,000 units. It works pretty well. It's good enough. I now have the rock element. I'm going to add another one and I'm going to use another layer from our material, which is called snow. So to make the snow cap nicer, I'm going to also play with the falloff. I'm going to add a very large edge offset. So it really only stays on the mountain caps. One really interesting thing that we can use here is the modulation texture. It's simply a noise texture that we can use to modulate the painting. We can increase the texture influence and increase the texture tiling, and as you can see, it adds some noise. It makes things really interesting. This is all dynamic. It's all being rendered and all being painted to the landscape in real-time. Very good. Now we have our appearance for our mountains. We can start playing with the splines. As I said before, our custom brush, it's generating a signed distance field based on the shape of those splines. So whenever we play with it, this is automatically updating this distance field and generating a different shape that we can use. It should be good enough. For now we're going to very quickly copy and paste, or duplicate this brush around the level to create our background scenario. Pretty good. Now we have our, let's call it our background-- mountain background that we're going to use for our level. Great. Now I'm going to demo a little bit of the new Edit Layers functionality. Landscape Edit Layer System allows for a stack of compositing layers. It basically means that landscape, height maps and painting can be added separately and in a non-destructive fashion. You can add multiple layers to our landscape that can be edited independently from each other. You can use different layers to separate different functionality. For example, you can have blockout or foundation layers for mountains, or other non-interactive parts of the landscape. You could have a specific layer just for spline roads or flat terrain, which may be an important part of the level and need to be designed separately. It's important to know that all the layer compositing happens in the editor. The layer composition always gets baked down to a single texture. What it means is that there are no extra costs to use the Edit Layer System, as landscape height maps and paint layers are baked down to a single texture as you package your game for distribution. Back to our level. Let's first rename this guy. We'll call it base layer. Then I'm going to create a new layer. I'm going to call it level. So we're going to add a new custom brush, similar to the others. We're going to scale that up a little bit. I'm going to first rename this guy and call it canyon. I'm going to cap this shape because this is going to be used to create this canyon-like shape. We went over that before. Let's add some smoothness. Let's add some curl noise. 0.15. Then after we're done let's play a little bit with the shape of it. That should be pretty good. Let's now add some paint layers. I'm going to add the same rocks paint layer that we used before, but we're going to paint it a little bit differently. So this Blueprint brush allows us to mask the painting using a band. It's pretty useful. It uses a band around the surface. We can play with the offsets here. It looks really nice. Let's increase the falloff. It actually requires us to have a much smaller band thickness. That's good enough. OK, now we have our let's call it our arena. To wrap it up, we're going to add another Landmass brush. It's going to look very similar. Let's add some smoothness. It's going to be a little bit smoother because we're going to use this as a body of water that's going to be our lake. It's going to be right in the center. Again, let's add some randomness using built-in curl noise effect. Let's increase this in size a little bit. That's going to be our lake, or our lake-like surface. Let's add a paint layer. Now we're going to use the mud layer of the material and play with its values a little. And for this one, we're going to use the same feature that we use in the mountain caps. We're going to add some texture, noise, pretty cool feature. Increase falloff width a little. Yep, that should do. OK, and then we're done. And as you can see, we can easily turn that layer off or we can even change the order of things. It's not going to be affected, but now that the level layer is below the mountain, you'll see that the mountain will have priority over this. As I move the layer over the base layer, it's going to have priority, so it's going to affect the mountain to that surface that we're trying to achieve with that custom brush. It's a pretty nice feature when you want to separate different parts of the landscape. To wrap it up, we're going to create another new layer and then just call it noise. And for this, we're not going to use the regular Landmass brush. We're going to use the material only brush, which is a much simpler implementation. If I wanted to start making custom Landmass brushes I'd probably start with this one. Just add this guy. It's going to add a random noise to our entire level. This is also a pretty cool, very interesting side of our Landscape Layer System. If I move the noise layer below the level layer, you can see that it only affects base layer, but the level design layer, it's unaffected. But I actually want this to affect everyone. I'm going to change a little bit. It's going to just add slight randomness to the surface to make it look really nice. And we should be good to go. Runtime Virtual Texturing provides a very efficient way to render complex material. A Runtime Virtual Texture creates its texel data on demand using GPU at runtime. It works similarly to traditional texture mapping. The RPG caches shading data over large areas, making it a good fit for shading that uses decal-like material or splines. It allows for very unique layers and textures and terrain effects. It also allows advanced blending between landscape and static meshes. For this demo, we're going to use a similar technique to simulate bodies of water and affect not only our landscape, but other static meshes in our scene. Before we move on, let's first create our body of water. We're going to add a plane to the level. I'm going to scale that up a bit, moving it accordingly. Apply a water material that we have previously created. This material shader is pretty complex. It already gives us some really nice reflections-- some water transitions. We're going to use runtime real textures to create a really nice blending between underwater and the part of the terrain that's not underwater. We're going to create this really nice wet effect on the border of the landscape. How can we do that? First, we need to create a runtime virtual texture. I have previously created one, but I can easily right click, go into material and textures, and create a runtime virtual texture here. If you look at the options, we're going to use the world height virtual texture content. You're probably going to use any of these other contents if you're using runtime virtual textures for decals, or to bake roads into the landscape material, or maybe you want to use that to plan static meshes with the landscape material. But since we're going to need to save the world height of some static meshes in the world, we need to use the world height texture mode, because this is able to store a much higher resolution data values to this texture. OK, good. Now we're going to create a runtime virtual texture volume. And what this actually does-- this is going to be used as the matrix that the Engine is going to use to project this virtual texture into the world. For a proper projection, we need to actually pick the bounds that we want this vertical texture to be applied. So I'm going to select my landscape and I'm going to press copy bounds. And as you can see, it has this huge box. It's going to use this entire area to render our runtime virtual texture. And after that, we just need to select the texture that we want to use, dragging and dropping here. Now the Engine is already rendering that texture in real-time. That's pretty good. How do write to those pixels? Well, first you need to have your material set up to write to the virtual texture. Can we do that? I'll show you. Let's first look at this material-- water material. And as you can see here, there is this note, runtime virtual texture output that's basically writing some stuff to the world height and what are we writing here? getting the absolute world position of that pixel in the world and we're basically figuring out all the other coordinates, just getting the b channel which represents the z, the height of that specific area, and then we're saving that to the texture. OK, how do we make sure that this static mesh is going to be written to the runtime virtual texture? It's pretty simple. Just go into static mesh options. And here you have this new tab called virtual texture. To add a new virtual texture, select water, and as you can see, this body of water, this square plane, it's already been added and rendered to the virtual texture. And as you see in our landscape, you already have this really nice wet effect. But how is this achieved? Well, for that, we need to look at the landscape material. And the landscape material can actually have a different node, where we're reading from that runtime virtual texture. Remember that texture is saving the height, the virtual height of that body of water. And we're doing some magic here, some math magic, then comparing with the absolute world position of the landscape. And then this shader note outputs the interpolation that I'm going to use to effect the roughness of the material, and then I'm going to apply that to the base color to darken a little bit, to increase the effect. For now, to wrap this up, I need to change some settings. As you can see here, my water body plane, it's rendering only to the virtual texture. I'm going to change that option so it renders to the virtual texture and the main pass. So now I have my body of water, and as I move this up and down, you see that it automatically affects the landscape. Because this is affecting the runtime virtual texture in real-time. Really neat, huh? What it's also really interesting is that since the wetness effect is written in the material, you can actually read from that virtual texture in any material of your game. So we have some Megascans assets that we downloaded using the Megascans plugin. And as I add these guys here, I'll play a little bit at the scale. You can see that we had already previously changed our Megascans material with those same nodes. We're reading from the same runtime virtual texture. We're doing our math here and then applying the base color and roughness. And as you can see, my manually placed static mesh already has the same wetness effect. As I move the water, it affects wetness of that object. Let's add some vegetation to this. I'm going to show our grass system again. As I said, part of it was previously setup. Let me show you how to set up that very quickly. In our material, we're basically doing some shading or subtracting the rocks and the mud channels, and inputting directly into this node-- the material, landscape, grass output. And this note we're going to configure a landscape grass type object, which we're calling here grass foliage. Double click that and you will see that this object simply defines static meshes, and it's going to spawn and spread around our level, and you have some other options like the scale, random rotation, and a grass density. As you can see here, our Procedural Grass System is using the landscape layers to apply grass around the scene. If I can quickly show you as we move this around-- our lake around-- that's going to apply the landscape materials to the landscape and our grass system will update accordingly. Let's say we increase offset here of the mud material, which is going to make our grass go a little bit further. The Procedural Foliage Placement Tool lets you populate your scene with foliage in a matter of seconds. It does allow for extensive configuration, including slope, height, and obstacle avoidance, and other different spawning methods. You can spawn foliage at random locations or more organically with clusters of foliage. Foliage types come with a number of different properties that you can adjust to control anything, from how the foliage types are placed on other objects on the level, to how the foliage will grow and spread throughout the foliage spawner. In the following section, we'll take a look at what properties are available in foliage types, and how you can manipulate these properties to get the results you desire. First, let's make sure that the Procedural Foliage System is enabled. Let's go to edit, editor preferences, experimental, and enable procedural foliage. Second, let's create our first procedural foliage spawner. Let's open it. Now, let's create static mesh foliage. And here on the static mesh option, I'm going to look for one of the trees that I've previously downloaded. The press save, now we're ready to spawn these to the scene. Let's set its location, and I'm going to scale this just so it covers the entire surface of my landscape. Very good. Now I just need to open my procedural spawner, add a new foliage type object, and I'm going to drag and drop my static mesh foliage. Press save, and once I press re-simulate, I'm going to have this procedurally generated forest. Moving on, let's play with the foliage a little. I'm going to double click this guy. First, I'm going to add some exclusion landscape layers. I'm going to add rocks, and the mud layer. I'll press re-simulate, and as we can see, we're already skipping both the rock layers and the mud layer that we use for our lake. Now let me reduce that density. I'm going to add a smaller value, simulate, and then I move closer. And as you can see, the Engine is spawning these trees in clusters. The procedure of foliage system-- it's kind of trying to mimic nature here. It's spawning random seeds around the terrain, and as these seeds grow, there's a higher chance that they're going to spawn more seeds around them, which is the reason that we're seeing this cluster pattern. Moving on. Let's first enable collision with world, which is going to fix some of the problems and avoid spawning trees over static meshes. Let's play a little with the collision radius. And you can see here, this cluster, these seeds are being spawned very close to each other, around one meter, so I'm going to increase that to 2 1/2 meter-- 250 units. Then, as you can see for these kind of trees, it looks a little bit more realistic. We're going also to play with the spread distance. So I'm going to set this to two meters so we're going to have like, bigger clusters of trees, larger clusters. And now we're able to move to the visuals. We can play a little with the seed density. Let me increase that. I get this very dense forest, probably a little bit denser. As you can see here, you have some flat appearance in front of those trees. The reason is that the number of simulations here-- the number of steps here it's not very large. Let me increase that to 10. So it's going to have more simulation cycles. Now as you can see, you have much older trees which are much larger. You can temporarily play with that a little with the max age parameter, or maybe the procedural scale around 2.5, so we have like, taller trees, smaller ones, and it gives a more natural look. Very good. To finish that, we need to make sure that we enable distance field lighting. Of course for that, you need to make sure that you have distance field enabled in your project. Go to settings, project settings, and you need to have generate mesh distance fields feature enabled. We have these really nice looking shadows, not only on the tree leaves, but also here, close to the ground. Very good, and everything in real-time. Great. Moving on. The Procedural Foliage System does not necessarily need to be used to spawn foliage. You can add some variation to a level using it. I'm going to show that. Let's create another spawner. Let me open that. And I'm going to add static mesh foliage that I previously created. It's just going to spawn a rock static mesh in the scene. I'm going to drag and drop this-- exactly the same, like, the other one, once I press simulate. I have have randomly placed rocks on my scene. Randomly rotated, and they're all aligned with the terrain so they look pretty good. You can also add a little bit more variation by adding new foliage types here to the procedural rocks. And one thing that is very important. If you're speaking of a game, it's probably important to take a look at the collision options, because if it's a third person game or a first person game that you may need collision with these randomly placed objects, so you can change the collision presets here and actually have them to collide. And that should wrap up our demo. We can change the sun's position and see the lighting react in real-time. Everything in a very dramatic way. But that should be it. Keep in touch for the next videos and the next updates, and follow us on our social networks. Thanks for coming.
Info
Channel: Unreal Engine
Views: 287,578
Rating: 4.9487953 out of 5
Keywords: Unreal Engine, Epic Games, UE4, Unreal, Game Engine, Game Dev, Game Development
Id: gbj1qgPOl3E
Channel Id: undefined
Length: 28min 8sec (1688 seconds)
Published: Wed Jun 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.