Brushify: Bootcamp - Procedural Grass Tool in UE4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] everyone Joe goth here creator of Prussia fighter I Oh welcome to another episode of brush if I bootcamp in this episode I'm gonna be talking about procedural grass brush if I uses the Unreal Engine for procedural grass type system the grass type system is basically a set of files that let you change the meshes that spawn on the landscape and also change their scale their density all of that kind of good stuff we'll also be going over how those grass type files connect to the brush afire landscape auto material and you know how of this sort of chain of connections work so that you can set up your own custom grass type files if you like content like this be sure to head over to WWE to our forward slash boot camp and you can check out all of the videos on that page you can also sign up for the mailing list there you can also subscribe to the YouTube channel by hitting subscribe and hitting a little bell notification icon below and by the way all of the boot camp tutorials are completely free so let's get started and let's see if we can make some custom grass so the first thing we're going to want to do is find a way to access the grass type files I'm just going to jump out of the plane mode here and I'm going to go up to content now I'm going to bring up the content browser and I'm gonna head straight to the brush if I folder inside of there I can go to materials landscape grass types inside of the grass types folder you'll find each of the grass types associated with the various brush apply paint layers so you can see here beach desert rocks forest grass all of those and if we go up to the landscape tab in the modes panel and we hit the paint tab and we come down here we can actually see all of the different paint layers that obviously we can actually paint down and as we actually paint each of these paint layers I'm just going to demonstrate this let's paint down forest layer and you'll be able to see that not only do I have the texture but I also have some slightly different objects that are spawning on this layer this forest layer got these sort of rocks and some you know small plants and stuff but way less grass whereas on the grass layer I've got this kind of nice fluffy grass going that is completely different and the grass type system or the grass tool in unreal is the method for for basically changing the meshes that spawn per paint layer so if we go into for instance this forest layer I'm just going to go algae forest and I'm just going to bring up that grass types file you'll actually be able to see that there's a little list here and this list contains all of the meshes and various settings for those measures that allow them to be placed on the terrain so any mesh that you add to this list is going to start to spawn here on that paint layer and the inner workings of that already set up with the brush refine material but we're going to go over that later and how that's exactly set up but for now if you just want to actually use the grass type system and you know tweak some stuff maybe swap out some meshes we're going to change the sizes you can just do that right here in the grass types file everything's all set up for you with these files so just head to brush Rifai materials landscape grass types and that's where you can access this so we're going to try something now where I think I'm gonna try and find a good example we've got these sort of brownish rocks here but you can see that there's a setting here on this brownish Rock for grass density I'm gonna try increasing that to 50 I'm gonna see what happens you can see that now we've got basically Visio three or four times as many of these brown rocks spawning if we go even further 150 now we've got almost nothing but brown rocks spawning and yeah so this is just a case of finding parameters that you find comfortable and you think look nice and you know finding things that look good aesthetically the other big the other big parameter here is also the scale so you can see that we've got the scale set to not 0.1 to no point 4 and that means that we've actually got a random scale between 0.1 and not point for happening for our assets so if we change the maximum scale to 5 you can now see that the brown rocks are absolutely humongous so let's change that back down to like three and you see they're getting smaller one smaller still and then back to what they were before and 0.4 and now they're back to a reasonable size so by tweaking these scale parameters you can alter the scale ranges how the procedural assets are actually spawned the scale can also be unlocked so you can have a free scale which means you could change only one scale but then of course you will get these crazy stretched rocks happening because only the z axis is now being scaled so you've got control over the dead the x y&z axes there you've also got parameters for the culling distance so if you you know you don't want to have your assets spawning past a certain distance you can also control that there's also a parameter that lets you choose how they're actually placed you know sometimes sometimes you actually want an asset to be placed in more of a grid-like pattern so if you want you can actually in it take use grid and then you can share in the placement jitter to zero and I think if we upgrade the density a little bit we should be able to see that they are forming in a more like grid-like pattern yeah there we go so you can see there are sort of grid lines forming now and if you increase the placement jitter they're now forming more randomly you can also decide which is a better pattern for you if you turn on grid grid and turn up the placement jitter that might give you better results than if you disable grid entirely so that's up to you just play around with that you know see what works best for your procedural distribution and so this is just one object that we've been tweaking now the cliff slab but you can see that in this file all of these others like this gray rock here let's see if we can find some others simba clovers that's these little guys these little clovers those are also in the file I've got their little flowers let's go crazy with the little flowers path has white flowers everywhere so you can see how you know the possibilities could work for this you know you could really go crazy with a paint layer and have that one spawning just the flowers that you want or you know having more of the detail that you want and of course this goes to you know the same with deserts and you know you want on deserts you want different foliage with completely different colors spawning you don't want to have green foliage spawning in the desert you would want one more sort of dry foliage and so all of that sort of setup here in the so here for instance is the desert rocks grass type and you can see what this kind of brownish rocks that are spawned instead so yeah and yeah so the next thing that we're gonna try and do is we're actually going to add a custom mesh to this procedural layer I'm actually going to just go back and change that flower setting back to something reasonable I don't want to have too many flowers and we're going to add a new array to the list a new element to the array sorry click add element and now you can see I've got number nine and that's actually an empty mesh so recently epic put out a bunch of free foliage packs which i thought was really cool so what we're gonna do this in this tutorial is we're going to actually bring in a custom one of one of the meshes from the grass library they put out so it's project nature's grass library and we're going to go into that folder and we're going to go to meshes grass mesh and I'm just going to drag and drop one of those measures in I'm just going to set the density down a little bit so it doesn't fill it too much but I'm going to drag and drop that into my slot and now you can see we've got these little project nature grasses also spawning project nature grasses also spawning on this grass types layer which is great and now I can of course change the scale as well can maybe increase the scale of the grass I think they look a little bit stylized these ones but let's see if we can make them look a bit more natural so let's decrease the scale and see how that looks maybe we can try a different grass mesh one that looks a little bit less clumpy maybe this one okay that looks cool and I'm gonna actually add another array element and same thing as before I'm gonna drag and drop another grass mesh and this one's slightly different you can see this one's got more of a it's it's quite much more a tall grass and again I'm gonna change the scale here so that we've got a little bit more height variation so really this is a great system it just means that you can play around with different meshes that spawn on the surface here and tweak you know the the densities tweak the scales tweet the placement jitter always always make sure with foliage that you tick random rotation and align to surface because otherwise all of the grass will be spawned in the same rotation and that won't look so natural but yeah and of course the other thing you've got to worry about is performance please make sure that your any foliage that you put down or grass types you put down are in some way optimized so I think these ones are actually really well optimized you can see that as I move away from that foliage the loads are actually really helping them to to cull away some of the those extra polygons that we don't need so yeah just make sure that if you're picking any meshes for these lists that they're going to be well optimized that they can have lots that their shaders of course aren't going to cause too much over draw if we go to the over draw here you could see that all of the objects that I'm putting down on this procedural in it and with the with the grass tool are actually showing up in the green they're highly optimized for shader overdraw and that's the best thing ever because we're going to be layering up so much grass so yeah that's how you add a new mesh to the grass tool and how you add new measures to Russia Phi's grass types so the next thing I'm going to show you is actually how the grass type system is connected to the brush if I auto material now this is a little bit more complicated so you know if you just want the basics you know all of the the previous part this video is maybe all you need however if you're doing more complex editing you're definitely going to want to add custom paint layers and if you're adding custom paint layers you'll need to learn how to add your own custom grass types so yeah I'm gonna explain how you do that so if you go to content and we're going to go up to brush if I materials and landscape and we're gonna open the EM underscore landscape material file just gonna close everything down I'm gonna make this a little bit bigger so it looks very complicated on the surface I mean this is really everything that goes into making the entire brush if I auto material work so that's when you sculpt on the terrain that the texture automatically textures if you look inside this file there are tons of you know different functions and sort of texture related functions in here that are all working to make that happen but the part that we're going to be interested in is right down at the bottom and it's called procedural grass type enable / disable and if you look here if we zoom in you can see that there are a bunch of these sort of sample layer weights nodes we've got grass grass dry desert forests these match up with all of the grass types so these are just named this exact same and these are actually the paint layers so this is sampling a paint layer and then I've got a node here which is a switch parameter and this just adds a little switch to the mi landscape material so if we jump into the mi landscape material scroll scroll down find the procedural section and you can see that we've got enable beach pebbles enable forests ground cover grass mud rocks so all of the paint layers or grass types are all listed here as well and those are each of these switch parameters and these then connect through well this is this is a mask that's being added in here that basically takes the paint layer and then it not only enables or decides if you are disabling it but it puts it through a mask and then it outputs that resulting mask onto this this is the all-important node this is where grass types are basically connected to the material so inside of this grass node this is very important node you can find this is all of the connected grass type files so if you see in here we've got all of the grass types they're actually all specified here in the material so if we wanted to create a new paint layer we would actually need to add a new grass type to this list and we would also need to set up something similar to this where we've actually gotten a way of enabling and disabling the grass type inside of the material instance and that's because not everybody always wants to have the grass type showing up all the time you know there are certain scenes that don't require the grass types and you know people always want to find a you know quick way to turn them off and that's why I always include a little checkbox or a little flag in the material instance of the landscape so you can just quickly enable and disable them I'm just going to show that right now so if I want to disable the forest layer we'll take a little second to compile here but yeah I just unchecked forest ground cover so if I want to disable the forest layer I just click on the landscape go to the details panel jump to my mi landscape material instance scroll down go to procedural and disable a forest ground cover just gonna sort my windows out a little bit so you can see this and if I click disable on that it's going to do some quick little recompile and then we're going to be able to see that the forest ground cover is now completely disabled now other grass types are still showing up so you can see all the grass is working but now this is completely barren I'm just going to revert that change and it's back again so yeah that's the great thing about having these little squid switches so really in order to create a new grass type for your layer all you need to do is just copy and paste one of these basically and add a new grass to the node node list and I'm gonna do that right now so I'm gonna make a little bit of room at the bottom of the flow graph here so I've made a little bit of space here at the bottom of the grass type section and I'm just going to drag this down a little bit and then what we're gonna do is we're actually going to switch out one of the grass types for one of our own custom ones now when you create a new paint layer you'll be able to plug in a sample from that paint layer just by just copying one of these and type in the name of your paint layer so for instance when we created the mud layer in the previous video we we just called it mud so if you just want to pick up the mud layer just make sure you call it exactly the same thing as it's called in the landscape paint menu so whatever it's called right here in this if it's called mud make sure you name your layer sample the exact same thing so let's see if we can do this we're going to go to sample mud we're gonna make a little connector we're gonna copy and paste this one this little switch parameter and we're gonna call this one enable mud mud grass and we're gonna hit true so we're gonna make that connected to so on the mud layer we're going to have it enabling mud grass and then we're also going to copy and paste this little guy as well it's a little subtract node and you can see that all of these are connected in the exact same way they're also kind of connected to the same output right here this is a very very important output so take that output right from the top this is the result of the auto material and you want to connect that to the subtract node and then we're going to connect this up and then we are going to add a new array element we're gonna call this mud grass and the next thing we're going to need to do is we're going to create a custom grass type file so I'm going to get mud or actually I'm going to copy and paste grass or a duplicate grass and we'll call it in mud grass and then I'm going to save that and then drag and drop it into the grass type slot here so we've now got a new entry called mud grass and it's connected to the grass type here now I'm going to scroll down to the very bottom and I'm going to take the output of this little bit of code here and I'm going to input that into mud grass and I'm gonna hit save you it's going to take a second to compile sheeters ok that's done I'm just going to drag this out of the way and we're gonna paint a little bit of the mud layer always takes a bit of time to compile when we first paint something down now you can see that there's actually grass spawning on the mud layer which is very irregular because before we didn't have any grass spawning there at all so if I come to the mi landscape again we can now see that we've got a new option in MI landscape it's just made this a bit smaller called mud grass and that's currently enabled but if I disabled that just got to recompile a few things now we've got our mud layer back to how it was before so as you can see we've actually now connected up a new grass type on the mud layer so that's now it's sampling the mud layer it's got an enable and disable pram so that it appears here in the material instance it's taking the mask from brush if I the slope mask the remove procedural layer all of that sort of information and then it's outputting that information that mask into the grass node which is then connected to the mud grass grass type and the grass type file then stores the meshes so this chain of nodes and files is what generates or allows the terrain or landscape to generate meshes or procedural grass types on the landscape so just to demonstrate this we can now go into if we go into the material instance and enable the mud grass we can now go into this newly created mud grass type and we can start having different meshes and different files added to that so I've also got the mega scans meadow pack so let's try dragging and dropping a few of those mega scans assets onto they're just going to delete some of the other grass varieties here because we don't need so many of them just remove some of this stuff and yeah let's drag and drop the clovers from mega scans onto there might have to make those a little bit bigger but yeah you can now see that we've got these mega scans closes that are spawning on the grass surface that's smaller and yeah the great thing about mega scans stuff of course is it's a super super detailed so let's try adding some more stuff here we've got what is this dandelions let's just make a new element every time usually I just try and set the density lower maybe just three or four three or four or five something like that and then scale half half scale usually those are the sort of usual settings that work for most assets and sometimes you have to increase the scale a bit and now we've got this little dandelion spawning on there so occasional dandelion spawning of course you know if you go completely mad you can have 2 nd Lions everywhere and yeah I mean that could look actually really good for mud you know sometimes you get these weeds growing up the mud in some environment some situations let's add another array element same thing I'm always loading the lod one because I'm not too sure if these were set up for Lots or not and yeah so that's how you can basically import mega scans measures or basically add mega scans measures into your grass types all within the brush fi system and yeah one more thing to note is that you can actually remove procedural grass from the landscape by simply painting the remove procedural paint layer so if I come into the modes panel and then landscape paint and I scroll right down to the bottom of the paint layers you can see this little paint layer here remove procedural and when I paint that down takes a little bit of a second to compile but when I actually paint that down you can see it starts to chip away or kind of remove any of the foliage so I can actually use this to remove procedural foliage from the terrain and of course I can make my brush size a little bit bigger and then you know completely remove all the foliage in an area and I could even remove the foliage from the entire map and then of course I can shift-click to add the foliage back in so click to remove shift-click to put it back and yeah this is a really great way to clear out foliage from your scene one thing to note is that this actually uses a no wait blend layer info so when you're creating a layer info make sure that you click no wait blended layer as opposed to a weight blended layer because that will the waitlet blended layer will actually paint down black on the terrain so if you get that problem that you're painting down black when you paint the remove procedural layer that's because you've selected a weight blended layer rather than a no weight blended layer but yeah other than that make sure you choose no weight blend and then you're pretty much good to go and you can you can start painting down or sorry removing foliage just by painting down this layer let me know if you guys found this video useful and please subscribe to the channel if you are interested in multi torez like this cheers guys
Info
Channel: Joe Garth
Views: 39,875
Rating: undefined out of 5
Keywords: unreal engine, unreal engine 4, unreal, ue4, procedural, landscape, procedural generation, material, tutorial, game development, epic games, terrain, procedurally, bootcamp, brushify, unreal engine 4 tutorial series, grass, textures, video game, game, how to, unreal tutorial, unreal 4 tutorial, materials, games, game engine, render, create, sculpt, gamedev, game dev, texture, project, indie game, education, ue4 landscape tutorial, engine, megascans, project nature, tool, automaterial, joe, garth
Id: AGgzAaAk7vI
Channel Id: undefined
Length: 27min 54sec (1674 seconds)
Published: Sat Apr 11 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.