Using Terrain3D in Godot 4 - Part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] terrain 3D was released 5 months ago and today we're entering beta with version 0.9 this new release includes support for good 4.2 dramatically improved texture painting an auto Shader with dual scaling holes with Collision paintable navigation and countless improvements I have so much information to share with you that I had to break this down into two videos this first part will cover installation texture setup importing data and some of the basic tools I'm also going to cover a lot of usage tips and you're not going to want to miss them in part two we'll cover the advanced features such as texturing material features holes occlusion coling and navigation let's get started let's set up terrain 3d come to the repository page and the first thing I'll highlight for you is the link to the documentation we're going to cover a lot of information in this video but you'll still need to refer to the documentation for a lot of information next let's scroll to the middle of the page and click on this releases link scroll down to the latest release open up assets and download the terrain 3D zip file here's what it looks like when you've unzipped the file and you know you have the right file if in this binary directory you have all of these compiled libraries let's open up gdau I always recommend running gdau with a console version that gives you this black window where not only train 3D but also the whole engine will give you informational messages let's import this new project good prompts us to restart you can see Gau is importing some of the assets and now we need to restart a second time project reload current project and finally we're ready to use the demo notice we've gotten a lot of information on this console window this is normal for the first startup here you can see the messages from the most recent load and it only has one inconsequential warning the installation instructions go over what we just did There's also instructions if you want to install terrain 3D in your own project to install terrain 3D in my own project I'm going to open up my project folder for out of the ashes go into the add-ons directory in the download I'm going to add-ons and I'm going to copy terrain 3D into my project add-on folder then once I load out of the ashes I'm going to go through the same process where I restart the engine twice when you're ready to make a new scene make a new 3D scene add in a new terrain 3D node notice it asks us to save the storage resource to disk so come over here click on storage save and we will save this as a binary res or resource file T reses is text res is binary these other two resource files can be saved as well they can be saved as a text resource file and the primary reason we would want to save the material and texture list separately is so that we can share them between scen scenes so if we look at the demo here you can see that the texture list is saved already so I can quickload it this is the one that came with the demo and you can see it has these textures already set up notice here the storage resource and the texture list are saved to disk right now the material is not we can also copy any of these resources and paste that in and now storage and texture list are saved to disk and the material has a copy of the demo material it is not save to dis they are two independent objects and any of the settings in here will be saved to this scene if you wish to build yourself which you should right now for Mac OS and certainly if you want to use some of the more experimental platforms like mobile or steam deck refer to the documentation where you can learn about the nightly builds and setting up the build chain if you have other trouble running the demo or installing terrain into your own project make sure to read through the documentation especially the troubleshooting page make sure you're using the console version so that you can get all of these logs there's debugging options and a whole variety of common issues and finally on the getting help page there's a link to our Discord server you can use the terrain help Channel and ask for help and you can also look at the GitHub issues where you can search for issues that have probably been solved before or create a new issue if you believe you found a bug next let's set up textures of course there's plenty of documentation you can refer to important points right now are we need to use seamless textures our texture sizes should be a power of two and square we're going to use 1024 x 1024 all of the ALB and all of the normal textures must be the same size and we need to channel pack our textures this is the format we're going to take the ALB or the color texture the height and combine them into one file and then the normal map and the roughness texture will be combined into another file so we're going to go over how to do that in this video normal maps come in two different formats openg GL or direct X the openg GL format is where features seem to pop out at you like the sphere and the pyramid here and in the direct X format they seem to be depressed in for output files we want to use either DDS or PNG and I'll show how to make both packing these textures using the gnu image manipulation program you can get textures from various websites like ambient CG however not all of them are good textures for you to use on terrain and it's just going to take some experimentation with them in order to learn which textures are good and which are not for instance Rock 28 here is the texture I was using originally for the demo in this video we're going to switch over to Rock 30 at a glance can you tell the difference between these two textures and whether one is better than the other for terrain I cannot and the only way we can tell is through experimentation so these are the original textures I was using for the terrain 3D demo and what I found is that this pattern tends to repeat quite a bit here you can see this white highlight all across and then also the shape of how it Blends this is a pattern that I found to be too repetitive so we're going to switch the demo from Rock 28 over to Rock 30 I'm going to download the 1K PNG package here are the contents so let's see what the individual texture files look like here is the color texture also known as diffuse ALB base color here is displacement also known as height sometimes called bump this is ambient occlusion which we're not going to use for the Terin system however if you have a texture set where you really want to use ambient occlusion I'll show you how to pre-bake it here is the roughness texture sometimes you're given a smoothness texture which is the same thing as this but inverted we can tell which is which by thinking about what this material is this is Rock so it should be very rough on a roughness texture a value of zero is very smooth or glossy a value of one is very rough since this texture is fairly bright that means most of the values are close to one which means it's a fairly rough texture if it was a smoothness texture it would be much darker gray and then we have two normal Maps one for direct X and one for openg G note that on Rock we can't really tell visually which is popping out at us and which is depressed in on other normal Maps it's more apparent but on this particular one we can't tell fortunately they've named the files normal GL or normal DX let's download from gimp.org and load it up according to the documentation we need to create two texture files a packed albo texture with albo and height combined and then a packed normal texture with the normal map and the roughness texture combined so let's load the color or Al bet texture the height or displacement texture and then I said I would show you how to pre-bake ambient occlusion so let's load that one in there as well and first let's talk about pre-baking ambient occlusion I'm not going to do it for this texture creation but I'm just going to show you how to do it now you can select the ambient occlusion map select all edit copy go to the albo edit paste and then you can change the blend mode of this layer to multiply and here's what it looks like with and without and then you can click down here to combine it I'm going to undo that and get rid of the ambient occlusion texture all right now let's set up the channel pack texture using our color or albor Texture combined with the height go to the ALB texture which has red green and blue channels go to colors components and decompose we're going to decompose into an RGB image and now you can see we have separated red green and blue into separate channels next go to the height texture select all or crl a copy crl C and crl V to paste it in I'm going to double click on this layer and name it Alpha and then bring it down to the bottom next I'm going to Colors components and compose now I'm going to compose an rgba image and make sure that the red green blue and Alpha channels align I'll click okay and this texture is channel packed if I need to resize it I can do that in image scale image not canvas size but scale image and then then I can resize it right here the next step is to go to file and Export don't use Save and then I'm going to save this in the rot directory of My Demo project for terrain 3D I'm going to name this rock 030 albo height. DDS and Export and according to the documentation for DDS files I need to choose bc3 dxt5 and generate M maps and then click export and that file is done let's close everything and now we're going to start Channel packing the openg normal map and roughness going through the same process here's the normal map in RGB let's decompose it we'll collect our roughness map if this was actually a smoothness map map we could change it to a roughness map by going to color and invert and this is what rock would look like if it was actually a smoothness map so we can invert it to a roughness map select everything copy go to our decomposed image paste it in name it Alpha and move it down to the bottom of the list now one other note we know this is already an openg normal map but let's say we got a texture pack where we only had a direct X normal map we can also convert this normal map by going to the green Channel and inverting it and now this was an opengl normal map but now it is direct X so let's undo that and now we can compose these four layers under colors components compose rgba make sure that red green blue and Alpha channels align scale the image if we need to this one is ready to go I'm going to file export and there's the file we just made let's call this file Roco 30 normal rough dot this time I'll use PNG just to show you normally I prefer to use DDS but just to show you the different settings I'm going to choose PNG and we can see in the documentation the settings for the PNG I'm going to enable the layer offset disable the background color and most importantly change the pixel format to 8 bits per pixel rgba and Export the file all right our textures are prepared we need to set these up in gdau here are the two files that we just made the DDS file is ready to go the PNG file however needs to be set up properly so I will click it go to my import tab change the compression mode to vram compressed I'm going to disable normal map and generate M maps and then click reimport now both textures are set up I can add a new texture drag these files in there and this should be good to go now to replace this base texture I can just change the texture ID down to zero and that's swapped it with the rock texture it no longer has such an obvious pattern one of our contributors is in the process of creating a channel Packer tool that we can use within terrain 3D it's not published quite yet but it should be out in the next week or two that way you can create channel packed PNG images without using however if you want to edit the image to do things like pre-baking ambient occlusion you'll still need to use an external program next there's further texture setup we want to do within this texture list if I right click on any of these textures I can bring them up in this edit window first I'll name this rock this other one I'll name grass it's already named grass and this one I'm going to delete note that you can either click the X in the corner or middle click a texture to clear it if you want to remove them you can only remove them from the end of the list next let's change some of these textures settings a little bit even though this texture is the default grass texture it's a little bit unrealistic looking so first what I recommend doing is finding some reference images here I searched on Google for Rocky Hills and I can find some images that give a more realistic look so if we compare these colors you can see that our colors are inverted the grass is too bright and the rock is too dark so let's try to match this up the grass I'm going to darken quite a bit change over to a green and I'll keep playing with the colors until I find something that reasonably matches what I'm going for let's change the other texture in this case it's dark and the way it Blends this color is through a multiply operation which means it only darkens however we can change to raw and we can make these colors as bright as we want let's start with about 30% brighter it's looking a lot closer and actually rather than just making this 30% brighter across the board what I'm going to do is reset this I want want to make it a little bit warmer of a color something like this and then from this orange color I'll make it brighter so I'll multiply this by 30% and now we have a brighter orange and I'll continue to adjust it and here are the final colors I chose these texture settings also include a UV rotation however it's a bit broken I I just can't recommend using it here's what it looks like on the Rock even at the lowest levels it just loses all of the details of the of the texture so it might be useful and some cases however I think it's a bit broken we're looking at seeing if we can figure out how to fix it we may remove it in the future for now my recommendation is use macro variation for detailing if you want to import data you can open up the Importer scene found under the terrain 3D tools directory click on the Importer node in the scene Tree open up the import file and you can go find your files to import of course there's a page in the documentation that goes over a lot of details that you should read I recommend only exr or R16 for height Maps I'm going to select this exr which is a 4kx 2K file the control file is proprietary to our tool so this is only useful if you want to Import and Export the control map out of our storage resource for that you can use exr and for the color file I'll import these uh smiley face drawings like I said this is a 4K X 2K image so I'm going to offset the position that I import - 248 by -124 so it should be centered and I don't recall if this exr is normalized which means the height values are between 0 and 1 or if they are full range meaning 0 to a few hundred so I'm going to import and see what happens it imported successfully however I see no Heights so indeed the height values are normalized I'm going to increase the scale by 500 and import again there we go next I'm going to open up some some GIS images here is an 8K height map because it shows up as all red it's probably a full range image in the color map I'm going to choose the satellite image in PNG if I imported this at the 0000 position it's going to appear here so I'm going to change this to 496 by 496 and that will make sure it is centered because I believe this is not normalized I'm going to leave this scale at one and then import the image and here we are we can expand the view a little bit if we choose view settings and increase this by 10 and then scroll down to the terrain 3D settings open up mesh and expand this out a little bit further and in the material we can change this to none and we can turn off the grid and the origin and terrain 3D and gdau can be used for G applications once we're happy with the imported file we can scroll down to the storage resource save it as a binary resource file and then we can load this in our other scenes we can also export data by loading up a storage unit here is the demo data I can go to export choose which map I want to export type in a file name and run and I'll know I have finished because I looked in in the output window where it says export error status is zero okay or I looked in my console window when we create a new terrain 3D scene we have an empty storage resource let's save this as a binary res and make sure that our gizmos are turned on you can see over here in this storage resource all of the arrays that hold the data are empty and with gizmos turned on you can see these highlighted squares terrain 3D allows you to allocate regions which are currently sized 1024 by 1024 and when I select this add region tool and then click you can see now I have a white square that represents one region and these arrays have increased by one I can add a few more regions and you can see I now have four these regions are the areas we can sculpt in and they are where Collision is generated if you just want to have a small world then I recommend that you do not do this where you just start sculpting around the origin Point as you see we've allocated four regions for this little sculpted area it's much better to do it just in one region you can see this is as much data as there was before but it requires only 25% of the memory as you sculpt new regions are created if you want to turn that behavior off you can go to Advanced and disable automatic regions the rest of these sculpting tools are pretty self-explanatory raise and lower expand away from zero reduce back towards zero the flatten brush is my favorite and smooth all of these tools have settings down here where you can select your brush brush size opacity and in this case being the height brush we can specify the height not only can you use the slider but you can also click here and type in a value that you want for for some of these settings you can type in a value that is higher than the slider will allow you to enter and then some of these settings have a dropper that you can use to pick the height skipping over these next three tools which are for texturing let's look at painting color this allows you to select a color and paint directly on the terrain it doesn't work right now because it requires that you have at least one texture let's look at a couple of these advanced settings note that Jitter and align of view are both enabled with this default round brush we can't tell anything but let's choose the square and you see that it's spins around that rotation is called Jitter if you want to disable that set Jitter to zero next you can see that this brush aligns to the view if you want to disable that turn off align to view and then no matter which angle you go to the brush stays lined up with the same grid painting color on the train allows us to further introduce more variation just make sure to do it subtly this path is currently painted with a color map if you want to erase the color map just paint white or you can paint white at a light opacity to more gradually erase the next tool we can look at is painting wetness what this does is it modifies the roughness value of the textures on the terrain so I can set this to negative and it's going to take the roughness values of the grass and The Rock and decrease it this is useful if you want to make a a very wet area you can paint wetness and then use the color map and make it darker and you can clear it just by painting roughness at zero that's all for this video in part two we're going to cover the advanced features such as texturing material features holes occlusion coling and navigation it should be linked on your screen if it's already out otherwise it'll come out in a few days so make sure you're subscribed so you don't miss [Music] it
Info
Channel: Tokisan Games
Views: 13,151
Rating: undefined out of 5
Keywords: godot, terrain, godot engine, gamedev, game development, godot 4
Id: oV8c9alXVwU
Channel Id: undefined
Length: 23min 48sec (1428 seconds)
Published: Sun Dec 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.