Project Description

In this Unity 3d tutorial we’ll go over how to create terrain very quickly using a heightmap of a canyon image. We’ll be using Photoshop to create the RAW image we need for this heightmap then import it into Unity. We’ll discuss the different settings that you need to look out for to ensure that your heightmap is properly setup to generate our terrain effectively.

Welcome to my unity tutorial this unity tutorial I’ll be showing you how to create terrain using a height map that we’ve edited in photoshop so it’s going to go into Google and we’re going to find a image of a canyon heightmap already going to select this first image right here go ahead and save that image go ahead and close this now i’m gonna go to open up photoshop and they would open my image right so we have our Grand Canyon image i’m going to show you a few mistakes that you might have when you first start off using a high map community so first off we’re going to just save this as a raw file right here it says format just going to select all and we leave the naming structure the same way click Save and just click OK right here right now it’s going to jump into unity going to create our train so the terrain settings are now under the game object create other you can see terrain is right here and the actual settings for the train itself or under this gear icon on the very far right under the Train cools at the very bottom you should see the Train resolution settings right here so we’re not gonna do anything with the settings quite yet so let’s just go ahead and import the raw image file that we’ve created already and we’re going to use the default settings and click on import you see you’re gonna get this really weird effect went on here little bit hard to move around unit is going to be very very slow if you have this type of effect you can see this kind of spiked up right here we have some of our terrain that’s being generated down here but it’s really really ugly so first off let’s go for what the height map resolution is set to buy now the hi Matt resolution is 2049 imap resolution has to match the height map resolution of your actual image now the high-resolution right here is always going to be plus one of whatever hi Matt resolution actually is sorry if you’re using a height map resolution of 512 by 512 the imap resolution here is going to be 5 13 so you need to make sure that this match is so it’s going to go let’s go ahead and go back into Photoshop and it’s going to create a new file that’s going to make this a 512 by 512 just make it easier on us on aim at grand canyon and click ok alright so let’s go back to our other image we’re going to go ahead and copy and paste it command a command C and command V to paste and going to resize is command t2e size all right now it’s going to say is God and resave this same naming structure on scans change the format to raw and i’m going to overwrite the one that we currently have in there click Save and one thing to note is the same channels in now if you see this will go ahead and show you what what the issue is with this is going to click OK go back into unity and go ahead and change the height map resolution 25 13 now and click import raw and click open can see the width and height is now set to one by one now we cannot change it to what everyone’s going to change to go with 512 by 512 the actual width and height of our actual image file click import and it looks like it fit the terrain just fine but we’re having this weird kind of you know single file type of weird effect that we’re having here now the reason why this is happening is because of that non interleaved of setting that we had in photoshop so let’s go back into photoshop go to file save as go too wrong once again click Save the place and this is what’s causing that issue the interleave order and nany interleave order now basically what the way that I understand this is that photoshop is saving this in multiple layers and that’s what’s causing that issue so it’s going to click click cancel now we need to go ahead and make this a grayscale image so first off let’s go to make sure that both of our when make sure that this is full screen alright make sure that both these layers are merged together select also them and then select merge layers right now we go to image mode grayscale click this card if you go back up to image Modi’s you should see now it’s set to grayscale right now is going to save this as a raw file replace and you can see that option one away going to click OK go back into unity and it’s going to reimport that as well click open and you can see automatically that are within hi this has been inputted into these two sections here click on import and there we go we have a pretty nice looking to rain there was instantly generated from or heightmap obviously it looks a little bit rough but you can go and smooth that out now you can also go back into photoshop you can smooth out certain area so i’m going to take my paintbrush tool and what the color set to a grayish color i can just go over some of these sections now if you’re familiar with height maps or normal math right like that you know that takes the highs and lows based off the whites and blacks of your image so with a great color it’s kind of a kind of a middle middle color it’s going to create kind of like a sloping effect so the darker portions like in the middle right here that are black was going to be very deep portions versus the darker grades which are gonna be kinda like sloped up versions or are you know sections and with the wider portions are going to be higher up portions kinda like mountains in a peaks so we’re just going to put in some gray in here and i will see the effect that we have in our height map i’m going to click Save scan same naming naming convention make sure that it’s set to wrong save click replace and once again make sure that you don’t have that option to for that not interleaved order click OK and reimport that once again make sure that the width and height is set to the same width and height of the image and also that the high resolution is set to the white one as well click on import and you can see the areas that we made a grayish kind of planned out and I can just go in here and start smoothing things out with this little button right here just to make it look a little bit better so it’s not as jagged now you can go back into the terrain settings if you want these areas be so high you can change deterring hide right here to 200 and you can see that lowered it quite a bit so now we kinda have some more like ridges like small ridges in small pits in our training rather than mountains and higher points but that’s how you quickly create terrain using a height map image editing in photoshop so i hope you enjoyed this tutorial thanks for watching!