---------- SETUP ----------
This tutorial works with Netradiant, but I haven’t tested with GtkRadiant, it needs a special Q3map2 compiler which Netradiant has, maybe newer versions of GtkRadiant include this compiler, if so please let me know.
You will need this :
-
Basic mapping skills
-
Basic modelling skills and knowledge of Blender (like installing addons/plugins)
-
Netradiant | download link (I used version 2013-06-30 32 bits)
-
Blender installation | I tested this tutorial with version 2.49b (Download Link) and 2.69 (Download Link)
-
Blender addons for .ase export | Blender Scripts (double-click on icon to download)
---------- INSPIRATION ----------
This tutorial is inspired by this tutorial and SimonOc’s terrain blending tutorial, I couldn’t have done this tutorial without these, so thanks!
---------- TUTORIAL ----------
The point of this tutorial is to make it easier for mappers to create terrain blending, with method inspired from SimonOc’s tutorial, instead of using the boring AlphaMod brushes on each terrain vertex, we will directly paint the terrain in a modelling editor, which is much easier!
STEP 1 : GETTING THE MESH DONE
There are many ways to create your terrain mesh, you can do it either completely with brushes from Radiant, or you can use any modelling editor that can export to .obj file format for importing to Blender at a later stage.
For example, I created my terrain mesh using Cinema4D:
But you can export brushwork from Radiant:
Once the model is done and you’re happy with it, you will need to adjust it’s UVmap in order for the textures to look correct on it. I will not cover this part, there are plenty of tutorials on the web and the method differs from a modelling editor to another one.
With Cinema4d, I could achieve this result with the model above:
STEP 2 : CREATING THE SHADER(S)
For this test, we will use textures from pak0.pk3:
Use this shadercode as a base for your shaders.
////////////////////////////////////////////////////////////////////////////////////////
// BackSnip3 terrain experiments ////
// During colorpainting, black = primary & white = secondary ////
////////////////////////////////////////////////////////////////////////////////////////
models/terrain/sample_rock_snow
{
qer_editorimage textures/sample_blending/rock_snow_editor.tga // texture for editor
q3map_clipmodel // make model solid
{
map textures/temperate_sd/rock_ugly_brown.tga // primary texture
tcMod scale 4 4 // scale by 4x factor
}
{
map textures/snow_sd/bigrock_rounded_faint.tga // secondary texture
tcMod scale 4 4 // scale by 4x factor
blendFunc blend // mix texture with primary texture
alphaGen vertex // alpha channel determined by vertex color
}
{
map $lightmap // apply lightmap to this surface
blendFunc filter
rgbGen identity
}
}
Don’t forget to update your shader list when you create new shader files!
For the tutorial, one shader will be enough to demonstrate the blending effect.
STEP 3 : COLOR PAINTING
YAY!!!
The following explanations should work for both versions of Blender detailed earlier.
Steps:
-
Import your model into Blender.
-
Apply a material to the model, give it the EXACT name of your shader path (ex: models/terrain/example)
-
Select vertex paint in object interaction selector:
Painting options are self-explanatory, on Blender 2.69 they appear on the left pane, on blender 2.49b they appear on the bottom pane, you also have more options if you press the N key.
Paint your model, just remember one thing -> black is primary texture only, white is secondary only.
I did something like this with my sample model:
Once you’re happy with your painting, export your model to .ase, don’t forget to select “Vertex Color” option before finishing the export.
With Blender 2.49b, material path can’t be longer than 21 chars, to solve this you have to manually edit the .ase file with Notepad to complete your shaderpath.
*MATERIAL_LIST {
*MATERIAL_COUNT 1
*MATERIAL 0 {
*MATERIAL_NAME "models/terrain/sample_rock_snow"
*MATERIAL_CLASS "Standard"
If you’ve managed to get all of this done, you’re nearly there!!
STEP 4 : USING THE MODEL INSIDE RADIANT
Create a misc_model entity, and import your .ase file.
Give your model “spawnflags 32” (insert key : spawnflag and value : 32)
If you didn’t put “q3map_clipmodel” inside your shader but still want collision ON, put spawnflags 34 instead.
You’re ready to compile!!
I managed to get something like this:
If you have any comments, please yourself!
---------- NOTES ----------
You can change “tcMod scale” value inside your shader to scale your textures if they appear too big or too small.
You can also use AlphaFunc GE128, using a secondary texture which has an alpha layer, to generate cool effects as in SimonOc’s tutorial (screenshots to come).
You can use different shaders for one model, just separate each mesh for every shader and do the correct paintings to have seamless transitions
between meshes.
You can apply “surfaceparm” landmine, snowsteps etc inside your shader, it works too!
If lightmap isn’t accurate enough, you can use “q3map_lightmapSampleSize” with a value < 16 to achieve more accuracy, don’t abuse this as it can lead to massive lightmaps amount. I suggest you not to go under a value of 4.