Jump to content
Official BF Editor Forums
Sign in to follow this  

Landscape Texturing (Updated)

Recommended Posts

Landscape Texturing

This Tutorial involves the use of the following software (free versions)




You'll need also a professional image editing program (windows paint is a no no), I'll explain the steps required with Photoshop, I'm sure everything can be done in PaintShop Pro too.

And finally you'll need:

bf2_tpaint, a simple yet powerful application made by Token

Terrascan Terragen script


Bat Files: a couple of batch msdos files I made (512 and 1024 maps)

Once you have all this stuff you can start the creative process.

Prologue: The Editor

Launch the editor.

Create a new terrain, it must be size 512 to follow the tutorial in every step, for 1024 maps read the notes at the end of the tutorial.

Save all and close the editor.

Chapter 1: Modelling a Realistic Terrain

I chose to use WorldMachine because it has a very good control over your Terrain, It may seem not friendly at a first glance but once you understand how Generators/filters/Splitters and combiners work you'll be able to generate any terrain you want.

This part is probably the most important since the final layout of your level will be deeply affected from your choices here.

You could replace this step getting a DEM (digital elevation model) map of an existing terrain, but this is out of the scope of this tutorial.

Our goal is to create a terrain with a river in the middle (I know you love bridges too) even terrain around it to build structures and some mountains around for scenery.

Let's start with a Perlin noise Generator, double click it and lower feature size at around 6.


In Menu, Heightmap Operators/Macro from library you'll find a very useful tool: Ribbon, open it and drop it on WM desktop, we'll use it to engrave our

river in the land.

Double click the ribbon and play with ribbon scale until you find a single curved shape that resemble a river, now tweak ribbon width to 0.1 and ribbon profile to 0.7


Add a costant from "menu/Heightmap Operators/Generators" and set it to 0.

Now drop in a Combiner form Heightmap Operators/combiners and link the costant and the ribbon on the input plugs, then drop in another combiner and link in the output of the first combiner and the perlin generator we had from the start.


Now Simple Trasform (in filters).


Ok, now another important tool: the height splitter (in filters). What this tool does is to cut your landscape profile in parallel horizontal bands so you can tweak them individually. Put Bands value to 3.

1st band: screenshot0058ho.th.jpg 2nd band:screenshot0063hj.th.jpg 3rd band:screenshot0078ic.th.jpg

So we have an upper band with moutains, a middle band with plain terrain and a river with low banks.

Now we equalize the upper band with a 0.5 value, we terrace the middle (n° terraces 2, shape 0.99) and we erode the lower with the erosion tool (found in natural filters).


Drop in 2 more combiners and combine first middle band and upper band, then lower band with the result and link the output to file output.


Double click File output, set a name and export with 16bit Terragen format.

For those using WM 1.2 or later version, here's an archive with marcos used in tutorial:


You should unrar them in /macro folder of WM.

Interface in VM 1.2 is slightly changed but you can link ribbon to cratermaker macro and have it work pretty much the same.

You may also want to export the terrain as raw 16bit selecting .r16 in file output module and then rename it to.raw with a command line shell to use it straight it in the editor (renaming it HeightmapPrimary.raw)

Chapter 2: Fractal Texturing

Install Terrascan Script in Terragen Directory.

Start up Terragen.

Assuming you have a not registered version of terragen in Landscape Settings set imagesize to 513.


Load up the .ter file you created in WM and set image size in rendering controls to 512x512, then click modify and set terrain height values between 0 and 1000 (optional).

Save your terrain as Intel order 16bit RAW in your new level directory and name it HeightmapPrimary.raw, it has to overwrite your new level blank terrain file.

Tweak Atmosphere settings haze density 0, Atm blue 0, Light decay 0 so you'll have pure colors and in light conditions, set sun heading to 0, sun height to 90 and toggle off "terrain cast shadow".


Now another important step: deciding whatever colors your map should have, we will assign the right colors later but now we have to set surface propreties to render fractal noise that mimic the terrain.

We'll make a desert/grass terrain: in Landscape, Surface map open the grass and sand preset, You should tweak in the advanced distribution tab the values of coverage of single materials, we'll keep the default settings for this exercise.

Now Execute Script and launch Terrascan, It will take a while to render 64 tiles 512x512 in .bmp format, when it's finished you can close Terragen.

Now in your Terragen folder you have 64 tiles 512x512 that merged form a colormap 4096x4096: change their names with the Rename_000_to_00 batch file so you can merge them later with tga_merge.

Chapter 3: File Conversions

Open Photoshop and load your 64 now-renamed .bmp files.

Open the Actions bar in Window menu.

click the "create new action" button in Actions toolbar: now you're about to learn how to create a macro in Photoshop so you can batch convert all the files (you'll do it several times again).

Name your macro and click Record.

Now every step you do will be recorded so don't mess around but only execute the following commands:

click the first of the images and do save as, select .tga extension in dropdown menu, click ok and close the image.

Click the stop button in Actions Bar, and now you're ready to execute the Automation.

In file, automated, launch the batch command.

In the new window under Action, select the macro you just recorded from the dropdown menu and select a folder to save your .tga files.


You can now launch tga_merge and assemble our noisy colormap.

If you had a registered version of terragen you could have set in the rendering options 2049x2049 as rendering size and avoid all this steps

When you finish open the file you saved as .RAW (your PrimaryHeightmap) convert it to RGB and save it as .png 24 bit.

For reference, HeightmapPrimary.raw is a Greyscale image (no RGB), and it is saved as 16 bit, not interlaced, count 1, Ibm PC.

Chapter 4: Gradient Maps

Now you could do this step in Photoshop, under image, adjustment, greadient maps, but we're going to use Geofrac2000 to spice up the thing (and so you can brag around you needed several programs to tweak your map).

Open Geofrac, in Heightfield Generators tab select I-2-H and click the "Push to select image" button, load your .png and we're ready to trow real colors on the map, but first let's render our terrain in 3d: click planar in mesh generators tab, then create mesh object, there you go, our terrain on screen. Make sure you have the "render using color textures" button toggled.

In View, new image view, select colormap view so you can see what you're doing in 2d too.

Now click the color & material tab and again click the gradient button.

Load a preset and click create Gradient, we'll use Earthly but we need to tweak it a bit.


Delete all the blueish markers, we don't need them since the blue on our map is rendered by "real" water and lower all the other markers till you match your river coast with the sandy colors, here you need some color taste, I won't give you precise indications.


Now Full zoom your Colormap and hit the oldie but goldie PrintScrn button on your keyboard. Save up If you feel like you wanna make some changes later and close Geofrac.


Chapter 5: Merging Fractal-noise map with Gradient map

Open Photoshop Create new image and paste the gradient colormap from the clipboard, draw a square selection (hint: keep shift pressed) around your colormap, copy and paste in a new image, finally resize it to 2048.

It probably needs some refining, it should not be hard: pick darkest sand color with eyedropper and bucket it on black areas.


Open the Terragen .tga colormap and resize it too to 2048.

Now drag your .tga over the gradientmap and play with blending options, I used Soft light blending on the Terragen colormap.


When you're satisfied save & flatten image (layers menu)

Chapter 6: Slicing

Always in Photoshop click on the slice tool and then click your colormap, then rightclick, divide slice equally 4x4: you'll obtain 16 tiles each 512x512 that is exactly what the tx0*x0*.dds files are.

Feel free to do any color balance tweaks for this colormap: it will be applied only on layer 2 in the editor so it is meant to be a grass type texture.

Now choose save for web in file menu, you'll get a new window, select png24 for all tiles, toggle trasparency off save and set the name of the file as high so you will obtain 16 files named from high_01 to high_16, you'll understand why later.


Now do a copy of this image and tweak it again as shown to give it brownish colors, it will be our new sandy (layer 3) color texture.


Again saveforweb, same as above but this time name it low. (it will be shown only on layer 3)


Do another copy, change image mode to grayscale and tweak brightness and contrast, it will be our rocky color texture, we're going for grey rock but we could pick any color.

Saveforweb, name it steep.


Now we need to convert all these images, we should have 16x3 tiles all png format, create another macro in action menu to flip them vertically and convert them to tga format (RGB, 24bit, not compressed, not interlaced)

Chapter 7: bf2_tpainting

Now extract bf2_tpaint to your level directory (use latest version).

In data folder of this tool you'll find grad_angle and grad_height files, these files are used by the program to decide how to apply your 3 textures to the terrain. Somewhere on this forum A Dice guy recomended to have clean detailmaps to improve efficiency, I think he meant that transition between texture should be sharp thus not having large parts of the terrain covered by 2 detail textures overlapped but only by one. For this reason if this was not a test we would edit the default grad_angle file that has a large gradient area and reduce it.

Copy my Gradient_batch_512 in bf2_tpaint folder and create there a directory named "Gradientmaps" with the 16x3 converted tga file in.

Run the batch, it will copy high_01, low_01 and steep_01 in your data directory renaming them high, low and steep and it will launch bf2_tpaint, after it finishes it will copy the tile that uses ONLY those slices (the other are usless for our purposes) to the newcolormaps folder, it will continue with high02, low02, steep02 and so on. Basically it will launch Token's tool 16 times to render separately the 16 tiles of the 512 map. It is important that you togle off the first 2 options of bf2_paint or it will mess up our work.

Once your clickwork is over, copy the all the files in newcolormaps to levels/example/editor/colormaps and the whole detailmaps folder to levels/example/editor, you should overwrite files again.

Epilogue: The Editor

Launch the editor, you should see your terrain with overbright colormap applied, go in terrain mode assign to layer 1 a detailtexture for mountains (rocky), set lowdetailmap to 2, planemap to 1, on the far right click set lowdetailtexture and generate low detailmap.

For layer 2 chose a grassy texture, lowdetailmap set to 1 and again generate lowdetailmap on the right.

For layer 3 chose a sandy texture, the rest same as layer 2.

Here's the result without any lightmap rendered:

example16jx.th.jpg example29ub.th.jpg


Notes for 1024 maps:

When you assemble the 3 colormaps they must be 4096x4096

Slice them in 8x8 equal tiles

Apply the Gradient_batch_1024, be ready for 10 minutes of clicking :|


with version 0.33 of tpaint you can automate the clicking in chapter 7, just open the script you are using in notepad and replace



bf2_tpaint.exe -mirror 0 -surround 0 -deltemps 1


To have it map correctly you have to flip vertically the 2048/4096 colormaps before slicing other than flip the single tiles after slicing.

Thanks to Token for update.

Share this post

Link to post
Share on other sites

I tried doing texturing and detailmaps completely in terragen but I had poor results. I created an indexed RGB palette as described by oscar but I can't match the quality of this way I described here, probably I'm doing something wrong.

Consider this as a different approach, if you feel itchy reading the tutorial maybe it's not for you, as I got Token's tool I felt like this is the way it should be used.

Bye the way, If anyone need the files of the final level or some previous stage, ask now or they will be soon erased.

Share this post

Link to post
Share on other sites

This is a great tutorial. Whats unclear to me is how to use this method with a level I've already been working on. Painting terrain that was created in the editor itself. What I did was took my heightmapprimary and converted it to .png. Then went straight to geofrac and proceeded with chapter 4. However when I rendered the map in 3d it didn't come out right. It had hundreds of sharp tall peaks all over the place.

Share this post

Link to post
Share on other sites

I understand what you mean. It happens sometimes, that because the raw format is not a real file format but rather is a dump of data used by the progam your using.

I don't really know what causes that "bug", while I was compiling this tutorial the map showed like that after I accidentally converted the file in 16bit Motorola order instead of Intel. On the other side I can tell you that I succesfully edited a heightmap both in the editor and photoshop adding an island generated as a standalone worldmachine file to an almost complete level without any problems.

My guess on that is that you pobably messed up some file settings. If you can load your level in photoshop without showing any spikes that is certain.

Geofrac (that is not really needed as I wrote above somewhere, it'is more of an eyecandy to view your terrain in 3d while you apply gradients) imports .bmp , .png and jpeg :| files in RGB format, try messing color depth (8-16 bit) with those.

EDIT: in 3d you mean in the editor? bf2Editor for heightmapprimary uses .raw. greyscale, 16bit, NOT INTERLACED.

If you still can't solve your problem... *shrugs*

Share this post

Link to post
Share on other sites

Ok maybe I checked interlaced when converting to .png . I'll start again and see what happens. When I said 3d I meant in geofrac.

Edit: Ok got it to render correctly in geofrac. When I initially opened the raw file in PS I changed the chanel count to 1 and switched to 8 bit instead of just clicking ok with whatever the default settings were.

Share this post

Link to post
Share on other sites

Great tut. I don't wish to drag off topic, but I am having the same spikey problems on just one surrounding map. It should be the simplest of all the surrounding maps, its just meant to be plain ocean.

This started with the ST that the ed created for me. I have tried removing and recreating, since then I have tried making a different terriain just to have some ST's to swap around. I have found that its just this one surround slot that is affected. I can put a perfectly good heightmap in, and it just spikes it straight up.

I have tried raising the height along the edge of my main map, so the map edge was above water, no go. If anyone works this out, I would love to hear it. I have followed this tut, and it spiked that up too.

Share this post

Link to post
Share on other sites

If you need plain ocean on a surrounding terrain, open it in photoshop, paint it pitch black or better RGB 1 1 1 and save it grayscale, 8bit.

Then in editor use the smooth borders on the right, the button you use to smooth normally your main heightmap corrupt the surrounding terrain, I think it tries to modify surrounding terrain with 16bit values and it fails.

Share this post

Link to post
Share on other sites

Just curious about 1024X2 map sizes. I noticed in your gradient batch script file, it dose not create enough tiles for a map that size, looks like it only works for a 512 map. I like the tool, but a majority of the maps I make are 1024X2. Can you tell me what I need to do to make this tutorial work for me???

Share this post

Link to post
Share on other sites

As I said in the tutorial the Gradient_batch is for 512x2 maps that have 4x4 dds files. To have it work for 1024x2 maps you should rewrite the bat, it's not that hard; First you have to slice the maps into 8x8 tiles so you have High_01 to high_64, low_10 to low_64 and steep_01 to steep_64, then modify the bat and tell it to rename and copy one file from each group, finally get the right tile section and rename it accordingly.

So in my bat there are 16 calls, your new bat must have 64 calls. I'm sure there's a smarter syntax to do it than how I did, but I'm not a coder so If anyone who has some basic coding skills wants to work on it, it would be greatly apreciated.

I'm actually working on a 1024 map so I'll write the new batch anyways, stay tuned.

Share this post

Link to post
Share on other sites

Khrimson, I edited the batch script for 1024x2 maps. All of my 64 images are waiting, now all i need to do is test. If it works out alright I will let you know and will send it to you if you want for everyone to download.

By the way..does anyone know where I can find a picture of the .dds grid that BF2 uses(diagram of where the tx00x00-tx07x07 files are placed on a given map). I thought I saw it somewhere but now I cant find it.

Share this post

Link to post
Share on other sites

for 512 maps:





for 1024 maps:









The grid tile position is identified by 2 numers divided by a x (hexadecimal?) the first numer is columns, the second rows.

Make sure that you have FLIPPED VERTICALLY all the .tga files before applying the batch.

This is how tiles should appear after the process:


As you can see all the texture should make sense and get same shading with different colors.

Share this post

Link to post
Share on other sites

I rewrote the batch script according to the .dds layout you provided as mine was wrong. It should do the job now.

As far as flipping vertically, I skip that step as I work the color layers upside down like the height map, so there is no need for me to do that. I guess if you train your brain to work like that it dosent make it so difficult to understand. I will give this new script a go and let you know how it goes. I really wish we could automate this more, having to uncheck the options and hit "GO" for bf2_tpaint 64 times makes it seem like endless work. I hope Token is following along this thread, maybe he can help out.

Share this post

Link to post
Share on other sites

Token's tool somewhere flip vertically some input files, so you only need to flip vertically tga files but not final detailmaps. If you flip the heightmap but not the tgas I think you need to flip the final detailmaps anyway.

Stick to the tutorial and it should be right if you follow every step.

I'll post the 1024 batch in a couple of hours.

Share this post

Link to post
Share on other sites

I wish I knew that Tokens tool did that. After finally giving in and flipping the tga's it worked like a charm. I was worried i was going to have to re-write that script again. But all is good. I love this way of painting as it looks very realistic.

Kudos Khrimson, this is definitely the way I will be doing my colors from here on out. I just hate activating Token's tool 64 times....maybe someone will help out with that.

Share this post

Link to post
Share on other sites

Updated batch files archive:


A note about using 1024 bat: size of 1024 colormaps is 4096 so slice the 3 colormaps in 8x8 512x512 tiles.

About Token's tool if you are brave and you have the original msdos version of the tool you can batch-flip the tgas in photoshop to counter the mirroring of the textures, it is a real pain to do that but you will avoid the clicking in my batch process and it will be fully automated.

Personally I gave up about that thing, if you look at Token's post about his editor in this forum you'll find a pic that shows how the tool mirrors the textures.

I hope Token will release eventually a msdos file of the editor with the mirroring-off option.

Share this post

Link to post
Share on other sites

once you have created the colormaps and detailsmaps in there full size (2048 for example)

save them as a 24-bit TGA file into the tpaint folder (where the executables are as the following)



set them to read only, then in TPAINT turn off the delete temporary files thing.

when you run tpaint, it will try and create these two files from the low-med-high images in the data folder, but cant because they are read-only, but the program will still run as if it had, so it will instead take your color and detail maps, and split them accordingly for you.

with the whole flipping thing, I know that with terragen, you need to flip the hightmap vertically or flip the color and detail map vertically (one or the other) before using them. for some reason, when you export a heightmap out of terragen, the output file is flipped, dont know why

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this