Creating Real World Terrain FROM HEIGHTMAPS in Unity!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys justin here with the realtimeessentials.com back then another unity terrain tutorial for you so in today's video we're going to talk about how to use a um height map image in order to quickly generate terrain of real world locations so let's go ahead and just jump into it alright so we talked last week about how we can use the terrain tools in unity in order to model out terrain manually but i did want to make sure that i covered um how we can use actual real world data and so the first thing we're going to want to do in this video is we're going to make sure that we have the terrain editing tools enabled you can do that by going to window package manager and under the unity registry we're going to look for the option for terrain tools and so you don't see that here it's because it's a part of the preview framework and so what we want to do is we want to click on this button right here to advanced project settings and make sure the box for enable preview packages is checked so that you can enable them then you just want to click on this and you want to download this and import it into your program so now what we want to do is we want to bring in a height map we can do that by going into our window terrain we want to go into the terrain toolbox and so remember the terrain toolbox is going to let us set our terrain length and width but what we want to do is we want to scroll down for the option to import a hype map and so we're going to bring in a height map file and use that data in order to create our terrain and so there's a lot of different websites that you can use in order to do this so one of the biggest ones is called terrain.party so you can use that to bring this in there's another one which i'm using because for whatever reason terrain.party doesn't seem to be bringing in my location so this one is just uh labeled hypemap.skydark.pl so but really you can just look for um you can just google height maps as well and there's a number of different tools that will pop up and so what i want to do is i want to select a location so in this case i've selected a place in colorado called castle rock and what i want to do is i want to bring this information in but we want to pay a little bit of attention what's shown on this page so notice how right now for example this gives us information saying okay the map that gets brought in is going to be 18 kilometers by 18 kilometers and then it also tells us our base level right here well there's an option in here where we can click and when we click that's going to tell us our maximum height so we're going to want to know our maximum height because we're going to set that when we bring this file in and so we're going to leave the other files as is by the way you can access this window by clicking on the little i right here but in this case we just want to download not the raw height map but the png height map you can also use the raw file there's a box you can check for that but we're going to go ahead and use the png file so i'm just going to click on this and it's going to download it and that image is going to look like this and so you can see what it does is it contains the information about that area in a black and white or more of a grayscale height map and so it's going to pick all that information up and it's going to use it to generate the ups and downs of our image inside of unity so now we just want to come over here and we want to do a few things so the first thing we want to do is we want to select that texture and so in order to do that usually you need to drag that texture into your project so i'm going to drag that into my project right here into my materials folder and i'm going to take that i'm going to drag it into the texture 2d slot right here and so before we hit anything else though we do want to make sure that we've set up a couple different things so the first thing is we want to set our width and our length to the same thing that we had inside of the website so if you remember this is 18 kilometers so we just want to type in a value of 18 000 by 18 000. we also want to set our terrain height and in this case we want to make sure that we've set that to that maximum height value that we found which in this case is going to be 2281.2 or just 22.81 so so then beyond that i think we're going to be in good shape for right now so we're just going to scroll down we're going to click on the button for create and so when we click on the button for create what that's going to do is that's going to take this grayscale file and it's going to use it to generate the ups and downs of a real world space just like this so you can see how we've now got this rather large image in here kind of representing the area right so it's got our different mountain files and other things like that now i will say this came in a little bit pronounced so what we want to do is we want to go back and test another setting so in this case notice how our height scale is set to 195 percent we're just going to bring that down to 100 and see what that does to our result so i'm just going to refresh this data and then we're just going to click on the button to download this again so we've got this in here and let's go ahead and delete out the terrain that we created and we're just going to run this again so i'm just going to bring my new height map in here like this and we'll go ahead set our terrain like this make sure our other settings are correct we're going to click on the button for create in this case i'm going to say continue and so if we look at this this brought our terrain in at a much more manageable realistic height and this is actually pretty accurate because inside of castle rock there is like a a hill that's like a butte it's like the actual castle rock is what it is but you can see how you can actually see that inside of this uh terrain this actually brought this terrain in at a realistic real world height so real quick two other things so the first thing is if you do get in here and you decide that you want to edit the heights of your terrain so if this comes in too tall or not tall enough or something like that you can jump over into the terrain settings and the little gear right here there's an option for terrain height and you can actually adjust the height so that'll make it more or less pronounced depending on the height that you put in there right so if i put a value of 3000 this is going to be way taller than it was before i left it at 2281 just because that was the max height that was contained inside of the data that i got the other thing is notice how this is a giant piece of terrain right and sometimes you may be limited with the size of things you can bring in or a lot of different functions but what you can do is if you go up to window terrain and go to your terrain toolbox under your utilities there's an option in here to split your terrain into multiple different pieces right so what that's going to do is that's going to give us the ability to texture those separately it's going to give us the ability to edit them separately and so what you could do is you could come in here and you could set this to have maybe like four tiles on the x and four tiles on the y and click on the button for split and so when you click on the button for split what that's going to do is that's going to split this into a grid four by four automatically so now you click on this you can see there's multiple different grids in here so there's four by four so that each one of these is in here separately so you can turn them on and off notice that your main terrain does stay in here so that's something that you might need to toggle off but this gives you the ability to work with the individual parts and pieces of your terrain one at a time and so in the future and we may talk about this in a future video we're going to texture this whole thing so i will link to my terrain tool so you can see how to start that there are some fun things you can do with texturing having to do with like steepness and other things like that that we're not going to get into for right now but if you're looking for a quick easy way to bring in terrain based on real world height data this is going to be a great way to do that all right so that's where i'm gonna end this video leave a comment below let me know if you have any questions if this worked for you i just love having that conversation with you guys if you like this video please remember to click that like button down below if you're new around here remember to click that subscribe button for new unity content every week as always thank you so much for taking the time to watch this i really appreciate it and i will catch you in the next video thanks guys
Info
Channel: The RealTime Essentials
Views: 701
Rating: undefined out of 5
Keywords: unity, unity software, unity 3d, unity 2020, unity 2021, unity terrain, unity heighmaps, unity terrain heightmaps, unity heightmaps, unity terrain from images, unity terrain generation, unity terrain toolbox
Id: eD2Ojp98UK4
Channel Id: undefined
Length: 8min 23sec (503 seconds)
Published: Mon Nov 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.