Page 1 of 1

Importing your terrain into blender

Posted: Sat Jul 22, 2017 5:25 pm
by barrington314
Why?
So you can add seamless banners like the rF national tracks have. Or bake an Ambient Occlusion map. Or model any other object that needs to match the terrain heights.

What's required:
Blender, terrain.png, and terrain.hf file.

Open Blender and delete the default scene.

Add > Mesh > Plane
Image

Next we need to open the terrain.hf file in notepad++.

Image

The first part we need to look at is the first number. As you can see, mine is a 10. Yours will either (most likely) be a 9 or 10. This is the resolution of your terrain.png (you could also just look at your png size but we need the terrain.hf for something else too). A "9" is a 1025 resolution, and a "10" is 2049.

So now we know it's a 2049 resolution and we are to the next number. The next number is your scale. Mine is 1.15. We need to do a little math to get the length of one side of our IN GAME terrain. That formula is ((png resolution - 1) * hf scale). So in this example we have ((2049 - 1)*1.15) = 2,355.2. This is going to be the X and Y dimensions for our plane that we just added.

Image

Now we need to re position the terrain. Or in other words, change the "location".
For this we are going to divide our dimension size by 2. So (2,355.2/2) = 1177.6.
In our Location, we are changing the X and Y values. However, we need to add a negative sign to the Y value.


Note: Im not exactly sure why, but blender changes the decimal points like you see in my preview pic. It's such a small change though that it wont matter.

Image

Now we need to unwrap our plane.

Pull up your UV Image editor like so:

Image

Now Tab into "Edit Mode". And go to Mesh > UV Unwrap > Unwrap.

Image

Once it's unwrapped, next we subdivide. The more you subdivide, the more detail you will have on the finished product. I usually can't subdivide a national size terrain more than 11 times or the program tends to run really slow for me. So you might find a little trial and error here and actually end up causing Blender to crash.
Anyways, hit your subdivide button how ever many times you think is good. Then TAB back into Object Mode.

Image

Next, add a material to our plane. Click "New".

Image

Now add a texture. Click new.

Image

Then click open. This is where you will find and select your terrain.png image.

Image

After that is added, in the same menu we need to change the "color space" to Linear.

Image

Now go to the modifier tab and add a "displace" modifier.

Image

Go the the texture icon within the same modifier tab and select your png image again.

Image

Change "Midlevel" value to 0.000
Change the "Strength" value to the difference between your low and high value in the terrain.hf file.

Image
Image

If you did everything correctly you should now see your terrain.

Image

TL;DR
-add new mesh plane
-make the dimensions the same size as your in game terrain size. i.e. (terrain.png resolution - 1) * scale
-fix the location. above size divided by 2. make sure your Y location is negative.
-unwrap the plane.
-subdivide as many times as you can. probably at least 9 or 10.
-add new material
-add new texture > open > find your terrain.png
-change color space from sRGB to Linear.
-add displace modifier.
-be sure you select your terrain.png texture
-change midlevel to zero
-change the "Strength" value to the difference between your low and high value in the terrain.hf file.

Re: Importing your terrain into blender

Posted: Mon Jul 24, 2017 5:31 am
by Wahlamt
Sweet barrington, thanks! :D
barrington314 wrote:Why?
So you can add seamless banners like the rF national tracks have. Or bake an Ambient Occlusion map. Or model any other object that needs to match the terrain heights.
Will there be a pt. 2 on these things?

Re: Importing your terrain into blender

Posted: Mon Jul 24, 2017 4:23 pm
by barrington314
Wahlamt wrote: Will there be a pt. 2 on these things?
Yes, I'd like to do that. Just don't know when I'll have more time. I'm hoping Aeffertz will help out with the banners part. The baking AO map is pretty easy.

Re: Importing your terrain into blender

Posted: Mon Jul 24, 2017 6:31 pm
by Wahlamt
barrington314 wrote:
Wahlamt wrote: Will there be a pt. 2 on these things?
Yes, I'd like to do that. Just don't know when I'll have more time. I'm hoping Aeffertz will help out with the banners part. The baking AO map is pretty easy.
Ok cool! Would be so amazing to have that too.

Re: Importing your terrain into blender

Posted: Tue Jul 25, 2017 7:36 am
by ColtonD719
Thanks for putting this together barrington! And extra thanks for writing it out in an easy to follow format with images. I find written tutorials to be much easier to follow than videos, which seem to be the norm now.

I look forward to the banner and AO follow-ups!

Re: Importing your terrain into blender

Posted: Tue Jan 16, 2018 7:59 pm
by Tiago Freitas #23
Barrington i´m looking forward on importing decals to the 3d terrain so we can make our renders! Thanks for teaching us how to import terrain.png :D

Re: Importing your terrain into blender

Posted: Sat Feb 24, 2018 8:26 pm
by Mcguire103
thanks heaps for this

Re: Importing your terrain into blender

Posted: Thu Jan 05, 2023 8:45 pm
by Donut MX
so whose gonna make the extended terrain tutorial :D

Re: Importing your terrain into blender

Posted: Thu Jan 05, 2023 10:57 pm
by AtlasZoor
Donut MX wrote: Thu Jan 05, 2023 8:45 pm so whose gonna make the extended terrain tutorial :D
ill probably make one once I get my get my next track out