Using Terrain3D in Godot 4 - Part 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome back to part two of using terrain 3D in the first part we covered the basics including installation and setup in this part we're going to cover the advanced features including texture painting I'll show you the recommended painting technique to get the best results we'll cover many of the features in the material paintable holes occlusion coling navigation third party tools and talk briefly about the future before we get started I want to bring up a couple of points that have become important since the last video if you have trouble make sure to always refer back to the documentation you may have missed a step or the instructions may have changed since these videos came out there are a couple common issues that people have had trouble with so I'll highlight a few instruction points to make sure you do not miss them here we go if you click on train 3D and find that the editor tools do not come up most likely it's because you haven't enabled the plugin if you click terrain 3D and the toolbar does come up however the buttons seem to be missing it's most likely because you did not restart when prompted or afterwards a second time if there was any question about that you could have looked in your console and you would have seen error messages about it having not fully imported the textures for the buttons when downloading textures they often give you different formats to choose from generally you want to use jpeg or PNG don't use exr unless you know what you're doing if you're setting up terrain 3D and you find that it's very slow to load up it's most likely because you did not save the storage Resource as a binary res file instead you saved it as a text T res file or did not save it at all if you have trouble with the textures it's most likely because you did not go through the preparing the textures document and we did talk about that in the last video but the point of these examples is that you need to refer to the documentation anytime you get into trouble double check and triple check to make sure you're following every step the instructions may have changed since these videos and make sure to look in the troubleshooting and tips documents texturing the terrain requires a bit of explanation the documentation explains the recommended techniques in detail we're going to go over a little bit of it here to demonstrate the texture painting tools I'm going to paint a cobblestone path on this grass area so first of all I'm going to select the paint Bas texture tool select my Heather texture and cover the area I'm going to select the next texture the Cobblestone path I'll reduce the brush size a little bit still using the paint tool I'll paint to path now I'll switch to the spray tool to blend in the edges and with a spray tool you can switch back and forth between the two until you get the desired look if it looks a little bit like it's repeating I can just introduce a little bit of variation and there we go an old Cobblestone path peeking through the grass now these two tools are for manual painting there is an auto Shader brush which allows us to Define areas that are manually painted versus automatically shaded the auto Shader needs a little bit of explanation so I'm going to use our in progress level for out of the Ashes to show off how to use it first of all in the material settings the auto Shader needs to be enabled down in the auto settings we need to specify a base texture and an overlay texture you can see I I have 17 which is my cavestone and four which is my green debris right here if I go down into the debug views and enable the auto Shader we can see that it is already set in a few areas White shows us where the auto Shader is enabled black is where the auto Shader is disabled and you can see that on these Hills and on this section right here it is currently enabled everywhere else it is disabled that means that these paths and this grass out here is manually painted whereas this section right along here behind these rocks it is enabled and over here it is enabled let me hide those rocks and you can see that here the auto Shader is enabled and it is texturing this green debris and rock texture based upon the slope and then that gets blended into the manual texture of grass and this path looking over here this whole section is manually painted whereas this section is automatically shaded to enable auto shading or manual we can use this tool Auto Shader I have it set to enable and this is now texturing this whole area automatically and if we turn on the debug view we can see that I've covered this whole area that's all automatic this section is all manual if I want to go back to manual painting I can disable the auto Shader and paint over the section and you can see that as I remove the auto Shader the manual paint job that I had done before is still there I can also disable the auto Shader by actually painting if I select a grass texture enable the auto Shader debug view you can see that the section on the left is automatically shaded and as I start painting the section with grass manually that disables the auto Shader I can then reenable it using this but that paint job by justed is still there it's just not used by the Shader while the auto Shader is enabled in that section and if I disable the auto Shader in the material you can see all of the manual painting that's there so using these two tools to paint and the auto Shader tool to enable or disable it should be pretty usable and intuitive there is one caveat though that needs to be Illustrated let's say I want to start blending in some of this Moss into this rock texture if I use the spray tool you'll see what happens first it's disabling the auto Shader in this section wherever I'm painting and it is revealing the texture that was there before which is the grass and then it is starting to blend the Moss into the grass texture if I disable the auto Shader you can see that whole black area is where it's manually painted and so I have manually painted grass surrounding manually painted moss and then surrounding that is the auto Shader so what I was hoping for was Moss directly in the Rock so what I should do is first turn off the auto Shader and see that my base texture here is grass if I start blending in Moss here it's going to paint Moss right on top of grass instead of moss on top of rock if we want to properly blend Auto shading and manual painting textures first of all it needs to be done on large consistent areas like this where there's a region of one texture it's going to be very difficult to blend manual and auto shading across this lip here where the two textures are coming together so find a section where it's either all flat or all slope and then we'll blend the two together then what I'm going to do is Select my cave Stone texture which is on the wall there and I'll use the base texture brush and then paint this whole section we disabled auto Shader you can see what I did by painting the base texture here I disabled auto texture for this section and I and I made a section of rock that blends in perfectly with the rock that was already there now I can use the spray tool and paint in the Moss and it'll blend in normally so essentially what I've done is I have carved out a section of the auto Shader for manual painting and then I've used used the recommended manual painting technique that I already described in the video between painting the base texture and spraying the overlay texture so basically do not use the spray brush on an autop painted section let's look at some of the material options if you click on terrain 3D in the scene tree and then open up a material you can see a variety of options let's turn off some of the settings and although it's not differentiated the Shader override is basically a divider the options above change the code of the Shader the options below are all of the parameters of the Shader eventually we'll figure out how to put in a separator there you can create a custom Shader by choosing Shader override enabled and that generates a Shader for you based upon the current configuration so if you have selected dual scaling Auto Shader texture filtering or or the world background this generated code comes from the options you've selected above so let's look at some of these options with World background you can choose between none flat or noise now this noise back here is just a gimmick and it's actually quite expensive so only use it on high-end Hardware if we scroll down to the parameter section you can see all of these World noise parameters allow you to control what the world noise looks like there's no Collision generated back there it's just a visual gimmick next we have texture filtering if you if you want to make more of a low poly world first of all you need to have low resolution textures or dramatically decrease the UV scale let's Zoom these up very large to 01 and then we can change texture filtering to nearest and there you get a pixelated look if we scroll down to the auto parameters you can see we can change the slope or if we go look at the mountain back here you can see that height reduction reduces the coverage based upon height and here I have the base texture set to zero and the overlay texture set to one which is identifiable by editing these textures dual scaling is a neat trick that allows us to change the UV scaling based upon camera distance it fades into to a different scale on the UVS scrolling down to the Shader parameters we can see that the Shader is set up for dual scaling only on one texture we can change the distance and the amount of reduction on the UV scale and if we turn on world noise because this background is not part of our sculpted terrain It Is by default far away so I've included a tri scale reduction to manipulate that far scale onto some of these other Shader parameters you can choose to use height blending which uses the height texture or Alpha blending there you can see the grass texture Fades into the Rock texture whereas with height blending it uses the height texture if we scroll down into the material settings let's look at macro variation the three noise scales and this noise texture if you were using terrain 3D before I had included a noise texture I I've now changed the parameters for the default noise texture so if you want to use this and I recommend you do clear the noise texture and then you can regenerate the Shader and that will generate a noise texture with the new settings this noise is sampled for a variety of uses one is for the edges of blending when texture painting and two is for macro variation so you can see a bit of tiling here for the first level of macro variation which are the smaller two noise levels we can adjust the two noise scales that are built into to macro variation level one and then macro variation level two is for a larger scale so by using these two we can introduce subtle variation into the texture there we go a little bit of blue on the first and a little bit of yellow on the second has greatly reduced any texture repetition and this applies to all of the textures so they're now subtle blue blues and yellows on this rock as well as the grass it's not perfect but it gets rid of a lot of the texture repetition here you can still see some patterns and you can make it stronger or adjust the scaling if you like in addition to all of these Shader settings there's also a lot of debug views I'm going to use out of the Ashes to show off the debug views we're still building out these levels so they're a little rough but they'll do fine to show off these views scrolling down in the material we can find the section labeled debug views Checker to self-explanation as is gray he map colors the terrain based upon height so lower troughs get a darker color whereas Peaks get white the color map shows where I have painted color on the terain and you can see in this section I've just done a little bit of green here in there to add a little more variation when we finalize this level I'll be painting color all over the place you can see when we look at the color map it's pretty subtle but blend it in with the textures it is pretty obvious when we're looking right at it so whenever you do color painting make it very subtle now you can't really see any repeating pattern due to the macro variation painting multiple textures and the color map once we add a layer of vegetation on here it'll look fine the roughness map is used to display where we have wetness let's say I wanted to have this area around the water trough be wet I might darken the color a bit paint in some dirt wetness and now I have a wet area then I can use the roughness map to show this darker area is where I have painted some wetness control texture takes the texture ID of what is painted on the ground and converts it into a color Value Green shows the base textures red shows the overlay textures Black is basically texture zero whereas dark green is going to be texture 1 2 3 4 and bright green is going to be closer to texture 32 dark red again is going to be Textures in the range of 0 1 2 3 3 and so on bright red will be textures closer to 32 where we see yellow and orange colors is where red and green are blending or where the overlay and base textures are blending together control blend shows the blending value of vertices zero means show only the base texture white means show only the overlay texture whereas gray values are going to let the Shader decide based upon height or Alpha blending how to blend the overlay and base textures together the auto Shader tells us where the Shader is automatically texturing which it's doing behind this Rock area wherever it's white is where it's using the auto Shader where it's black it is manually painted navigation I'll show in the navigation section turning this on is basically the same as enabling the paint navigation tool you can see over here I clicked on the navigation tool and it enabled the navigation Shader and this Shader just shows the area where navigation will be gener generated these next three texture options show us the texture Maps Blended together such as height so we're looking at the height textures themselves here are the normals for the textures here's roughness and then finally the vertex grid should be self-explanatory this shows us where the vertices of the mesh are and the vertex grid does work with many of the other options so you can leave it enabled holes can be painted on the terrain with a hole brush click there enable and you can paint a hole let's disable back cooling so we can see the back of the terrain for this example normally you don't need to do this this is just for the demo and now we can see that holes work just fine in collision and this works with gdau physics and jolt physics identifying where the mouse cursor is is still a little clunky the cursor works best when the camera is far away from the terrain if you paint holes with the camera right next to the terrain you're probably going to get holes on the other side you can see actually I'm drawing holes on the other side of the world so painting works best when the camera is far away from the terrain over here I've painted a couple holes in this mountain and then I created a mesh for the tunnel in blender and added some rocks for the outside terrain 3D now supports occlusion coing go into the train 3D tools bake uder 3D choosing log four as recommended and after 10 seconds or so the occlusion mesh is generated if we turn on gizmos you can see this purple mesh is there if I bring the uder out I can disable the train and you can see that the uder will hide the Box to demonstrate navigation let's open up the navigation demo and we can see the addition of an enemy character if I enable debug visible navigation and then run the scene we can see that a navigation mesh is generated of course there's a page in the documentation for navigation that you should read but let's look at setting this up if I select terrain 3D and then navigation tool I can paint an area that should be navigable then I can go to terrain and setup navigation and it's going to give me a new navigation region as a parent of terrain 3D I can then select this and save this navigation mesh Resource as a binary. reses when I run the scene you can see the navigation mesh has now been generated over there make sure to read through the document ation to learn the rest of the parameters here's a tip on Z fighting for you let's say you want to create a a plane that is used for water or an ocean as the camera moves around you can see there's a lot of fighting there this is not a problem with terrain 3D it is a problem within the G renderer fortunately though there's an easy fix for it in your view settings increase the zenier to something like 0.25 and you can see it's greatly reduced you also need to do this on your game camera so go into your player select the camera go down to near and increase this to something like 0.25 and then it won't be an issue in game either let's briefly go over some of these other settings coal margin is useful if you have World background set to noise and the height is set very tall you may notice that the mesh starts to clip out this isn't a problem with a sculpted terrain only with the noise background if you increase the coal margin up to say a th000 it'll fix that problem Collision is enabled in game by default however it is not present in the editor if you're using a tool like scatter you may need to enable Collision in the editor using debug Collision in future versions you will see that option under collision and collision mode you'll need to enable the full editor Collision mode which will generate Collision for all regions within the editor which you can see if gizmos are turned on this is a bit slow to draw so if you have a slow system turn off gizmos if you're interested in procedural generation you can explore the code generated demo when we run it we can see a world generated by code if we click here we can see the code that is used to generate this world if we look at the script we can see that first it creates a Terrain by code then it uses the fast noise Library that's built into Gau to generate a noise image that image gets imported into the storage resource and then and collision and a runtime navigation Baker are enabled and a little texture map is loaded in the corner and that's about it it's a simple script but it is a good proof of concept vegetation and assets are critically important for terrain to look normal here we have a little bit of vegetation that is mostly placed either manually or through some scripts that I've created or through proton scatter some of our users have been using and recommending simple grass textured I haven't used it myself but it looks like it will do the job eventually we'll build foliage instancing and painting directly into terrain 3D but this is a fine option for now another tool that we use and recommend is asset Placer by Cookie Badger with asset Placer we're able to load up different libraries of meshes plants vegetation rocks and structures and we're able to place them directly on the terrain this is a commercial tool and not open source although you do get the source with a purchase I can understand if you're not into paying for tools however I can say that if you're serious about making a commercial game using tools like this can save you thousands of hours placing objects on your terrain asset Placer is not required you can definitely place all these objects on the terrain yourself using the built-in level design tools but for some of you it might be the right tool to save you a lot of time mobile and web platforms are highly experimental right now some Advanced users are getting IOS and Android and steam deck to work at this time webg is not quite compatible because of some missing features in the renderer and you can read more about it here one thing I will note is that if you are targeting a mobile game you probably do not want to use DDS textures as they are not widely supported on mobile devices instead you want to use a format that gdau will import so you probably want to use PNG or TGA that way gdo will convert the files over to etc2 or ASC that mobbles will support train 3D is not created just by myself we have a lot of contributors rup and I are the original two authors when we converted the repository from private to public GitHub messed up the accounting this does not show all of his commits but he has a lot more we need your help to make terrain 3D the best terrain plugin for good so if you want to contribute make sure to read the contributing document and join us on Discord coming in the future we'll have paintable foliage GPU sculpting and much more to stay up to date you can review the project status page watch the repository keep an eye on the road map follow my Twitter at toison game and join our Discord server especially following the announcements and the terrain 3D channels all right those are the features I wanted to cover in these videos I didn't talk about everything so there's more to discover on your own and in the documentation otherwise I'll see you in the next [Music] video
Info
Channel: Tokisan Games
Views: 14,627
Rating: undefined out of 5
Keywords:
Id: YtiAI2F6Xkk
Channel Id: undefined
Length: 22min 54sec (1374 seconds)
Published: Sat Jan 13 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.