Procedural Content Generation - UE5 Tutorial (PCG Basics)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
oval engine 5.2 just released and together with it came the procedural Contender generation you can see right here I can drag this around a general engine trees and grass automatically for me so I just created this in under 3 minutes if I really wanted to if I play you can walk around and I can add static meshes across if I want to and really quickly just whip up this world now bear with me the the layout may change in future versions as developers announced but most of it will pretty much be the same and we will cover the basics so you can easily recreate this one first of all you need Unreal Engine version 5.2 or later installed then inside of Unreal Engine you go to edits plugins and look for the plugin here procedural content generation framework make sure this box is sticked and maybe you need to restart the engine when you have done that I'm going to first create a landscape to show you this so here under the modes go to landscape and let's create this landscape for testing purposes then we go to content drawer right click look for PCG this is a procedural content generation graph click on this one give it a fitting name hit enter and then drag this inside of your level so this is the area that this will be in so back here on the Contour let's double click to open this one up we get a bunch of notes here but I'll show you the basic ones first let's make some room between those first notes we are going to add so drag this off look for surface sampler and instead of in open this one up we want this onto our landscape so Ctrl holds to move the PIN to landscape hit save right now nothing happened but when I click here and I hit D on my keyboard you see this is in debug mode and then I see the areas here where my procedural content will be generated what you can do then is increase or decreases for example let's make this end time smaller you can see the amount of dots changes like I set it back and then I can change those what I can also do from the outpin I can transform points so we need points of this and we can choose an offset rotate this so let's rotate it between 0 and 360 so this can be eroded in any direction the scale maybe you want a little variation between for example points 9 and 1.1 I'm going to show you this later on these are rotated in different directions especially with the mesh you will see what happens then let's spawn in some meshes so from here static mesh power click on this one and then connect this to the output for the static mesh pattern I'm going to add in two trees so click this one and here the mesh entries one two because I'm going to add two three here in index one for example here in the descriptor static mesh so I already added two treasonous so let's choose those O2 and in this index let's choose this three right save and now you can see it's found a bunch of trees but this is very dense so let's change this one so in the surface sampler let's make this 10 times smaller hit save and see what happens okay this is already way better or maybe something like this okay and then you can see when I drag this around there will be another seat so this will be regenerated every time okay you can also increase scale but this may spawn and if you want to there is a check box right here unbounded now make sure you save your progress before you do this because this will be in the entire landscape so now I click this one and hit save you can see the trees are added on the entire level for tutorial's sake let's disable this so we can continue working on these now here in transform points let's say the smallest three can be 0.8 and a big three can be 0.2 I already set the scaling you can also choose an offset so let's say there are at least 20 centimeters inside of the ground for the trunk or something so it doesn't stick out and you can hit save right now you can see there's little variation in trees so especially when I exaggerate so let's say it the scale Max by the way let's uh oh let's keep the locker so let's say scale next something like five now this is not a good idea but just to show you there you can see you have some really big trees and also some smaller ones but this is why I exaggerate it's just to show you okay let's say 1.2 is fine and then hit save okay so you can add a bunch of trees here but let's say you also want to add grass with different properties so how we can do that first of all let's select those hit C to comment and name these trees then Ctrl let's select those Ctrl D to duplicate those and select this hit C on your keyboard and let's name this grass the output in outs and Landscape was again a surface but this time let's uh go to the static mesh panel instead of mesh entries let's add let's click this bin we need one index 0 descriptor and static mesh will be extra cross clumps for example this one's right here let's also reset them back to defaults maybe uh my grass I want them a bit bigger because the model is really small and then the sampler let's set this back the default 0.1 and then you can see we have grass and we have trees in our level but there are just few grass clamps right here so what you can do then set this to one hit save and there are more cross Clips but watch when you see for example on this respect to 10 it doesn't really increase so one is like a maximum for here but what you can do then the points extends instead of 100 that decreases to 10 for example then hit safe you can see there are a lot more grass clumps like this let's try 5 as a number and you can see it is already looking way better so this is how grass should be in the twist writer by the way I still here have this debug one on here so select this hit D once again so this icon disappears and now we can see our three slack normal and you can see I added them 20 centimeter meters below okay so this is what you can do and then you can just copy those and add rocks for example and also play around with uh with these points right here but now I'm going to show you let's also add a landscape material to this so I have my landscape select clicked on landscape I have some material prepared for this so uh I went to quicksil Bridge and I looked for some surfaces forest floor is the one that I used here so let's drag this first floor onto the landscape or have this one selected Ctrl space to lower this one and apply this right here and then you can see the PGG together with the landscape material makes for some pretty fast and cool uh levels especially as an indie it's really fast so now when I have this one selected you can see we move this around it changes or I can also all drag this out this might lag for you and have two different parts of this so you can have multiple of these instances you can create here as many of these PGG volumes as you want but let's go back to here but let's let's save all before I do this because now I'm going to check unbounded for both of these so my entire landscape is filled with crescent trees already and then I'm going to hit save and now you can see the unbounded effect is applied and is applied to an entire landscape so now I need to play I can test this out now this may lag at first so let's try this and then you can get this great effect but when you walk you can see my player is bumping why is this why we need to fix the collisions of the grass because I want him to go through the grass and attended by the grass so here in my grass folder right here static mesh spawner um with this one uh under here we can see Collision presets block all dynamic let's set it to no Collision then hit save and let's try again and then you can see when we walk around this error is fixed this is a quick one that I want to show you it's a pretty common error that happens um this is just scratching the surface these are just three nodes that we applied but there's a bunch of them a lot of filters but basically it is graphing the surface where you want to apply your points then you can transform them or add filters and with together with the meshes there's an output and there's a bunch that you can go through and also here in the level let me show you right here there are a bunch of settings that you can choose right here and also you can click each element individually and change them here and see the changes happen in real time don't forget to grab the free Game Dev toolkit in the description down below this video you will get my free ebook on how to get better at game development a free game design document to plan out your projects and a free tutorial Series where you create a platformer game from scratch and those who are hungry for more I offer sneak peek and overview of my new premium course the unreal fault where you learn how to create beautiful levels create a game from scratch to finish and how to set up boss fights and create Dragon fights with different attacks including fire breeding so if this sounds like a good deal to you I see you there click the link and grab your gamedev toolkit now while it's still free foreign
Info
Channel: Buvesa Game Development
Views: 3,100
Rating: undefined out of 5
Keywords:
Id: xq9cg7rFFKI
Channel Id: undefined
Length: 10min 17sec (617 seconds)
Published: Fri May 12 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.