Terrain by narc
Thanks to narc for the work put into this tutorial.
::In a Graphics Program::
(creating the heightmap)
#1 create an image that is 512x512 pixels in greyscale mode. save as: windows bitmap image (.bmp extension), 8 bit. comment: this will be used as input to gensurf. for this example i will assume you saved it as tut_heightmap.bmp and it resides in C:\
when your done the picture will look something like this:
::In a Graphics Program::
(creating the alphamap)
#1 using your same picture, resize it to 32x32 pixels, change it to color a format, now you will paint over it with the PENCIL TOOL.
paint the hill areas: yellow
paint the valley areas: blue
paint the rest: red
note: you may onLY use the same amount of colors as you have layers in your metashader. in this example we use 3 layers, therefore we will paint with 3 colors. also dont forget having three colors touching will result in a bad texture blend, dont allow that to happen.
(see picture: the red, yellow, and blue intersect and that is bad. adding more red fixes it!)
#2 we painted it in color with the pencil to make sure we had used only 3 colors in the picture, now we will again paint it with the PENCIL to the correct values. note: if you use anything other than the pencil tool such as paintbrush or paintbucket you may be painting with unpure colors.
paint the yellow: white (RGB value 255)
paint the blue: black (RGB value 0)
paint the red: grey (RGB value 128)
when your done the picture will look something like this:
#3 save the picture in greyscale mode as a .PNG
note: for this example i will assume you saved it as tut_alphamap.png -- you MUST place this file in C:\SoF2SDK\base\textures\heightmaps and another copy of it in C:\Program Files\Soldier of Fortune II - Double Helix\base\textures\heightmaps
#4 open it in irfanview and press the "I" key to verify the picture is in the correct format. download irfanview free at http://www.irfanview.com/ you should see that there is only 3 unique colors.
::In Radiant::
(creating the terrain entity)
#1 create a brush 8192x8192 units square, and 1024 units tall. (press "Q" to verify the dimensions) tip: 8192 is evenly divisible by 1024, always make terrain size divisible by 1024
#2 turn on View>Show>Show Blocks -- this shows the cutting planes, you want to align the brush edges along those lines. tip: since our brush is divisible by 1024 it fits perfectly within the cutting planes. this will prevent it from being split needlessly and will lower r_speed.
#3 choose Plugins>Gensurf>Ground Surface -- now set all of these in the popup window and hit OK
(general tab)
game: quake 3 arena
waveform: from bitmap
orientation: ground surface
roughness: 0
random seed: 1
(extents tab)
divisions X: 8
divisions Y: 8
decimate: 0
use bezier patches?: NO
(bitmap tab)
filename: C:\tut_heightmap.bmp (select your file with the browse button)
map color 0 to: 0
map color 255 to: 255
note: remapping the color values will affect terrain size but may cause errors, leave them at 0 and 255 there is a better way to do it.
(texture tab)
surface: tools/_terrain
other: tools/_caulk
steep: (leave it blank)
steep angle: 60
offset h: 0
offset v: 0
scale h: 1
scale v: 1
use pk3 file?:
NOin the gensurf plugin click OK
#4 gensurf should have made the terrain a func_group for you, that is what we want. now add these keys/values to it:
terrain: 1
alphamap: textures/heightmaps/tut_alphamap
shader: metashader/kam4
layers: 3
#5 select the terrain, choose Selection>Scale... -- in the popup box choose these values and click OK
X: 1
Y: 1
Z: 4
#6 you will now need to position the bottom of the terrain so that it lies perfectly along a cutting plane of the grid. now build a floor textured in tools/caulk to put under it. fully enclose your terrain by building walls and cieling from any sky shader texture you like -- make sure the sky texture you choose has a white border indicating that it is a SHADER. put a clip brush over the areas that you want no one to go, such as the map edge hilltops. add an info_player_start or info_player_deathmatch.
#6.5 you can add these keys to the worldspawn to optimise the compile time for testing!!! terrain maps take a long time.
_sun_light: 600 (a method of lighting the map, usually the sky shader controls the lighting. i believe this method compiles quicker at a slight reduced quality?)
_sun_angle: 75 -30 (the angle of the light)
grid: 256 256 256 (this will increase the lightgrid making compile time faster at a reduced image quality, you can also increase the values if you recieve a light grid array size error, it may happen if you make a really big map, normally you want to not ever use this for a final version unless entirely necessary)
distancecull: 2048 (this will reduce r_speed on larger maps by removing the polygons beyond the number of units you specify, it may sometimes cause flickering grey artifacts however)
fog: ar_fog_snowy_day (this will apply a fog effect to mask the distance culling. valid values are ar_fog_city, ar_fog_desert_day, ar_fog_desert_night, ar_fog_jungle_morning, ar_fog_jungle_day, ar_fog_jungle_night, ar_fog_grassyhills_day, ar_fog_grassyhills_night, ar_fog_snowy_day, ar_fog_snowy_night. you may also create your own fog shader -- these are defined in C:\SoF2SDK\base\shaders\arioche.shader for your refrence.)
#7 at last you can compile it, for testing i recommend to use BspFastVis(nolight) then quit radiant and compile lighting from DOS with this command: SOF2MAP.EXE -light -notrace -nogrid -nosurf C:\SoF2SDK\base\maps\terrain_tut.bsp
the error "WARNING: Couldn't find image for shader textures/metashader/filename_0" is OK. there you go, a small terrain map :) you can make larger ones by using a larger brush than 8192x8192. also you can make them less blocky by increasing the X&Y divisions under the extents tab in the gensurf plugin.
for more info, and info on creating metashaders please refer to:
section 2.3 of sof2_terrain.doc
the Q3A terrain manual http://qeradiant.com/manual/
the file C:\SoF2SDK\base\shaders\metashader.shader