News Design Materials Articles
 Terrain Blending  Page 5 of 6
Split level Blending As previously discussed, the primary and secondary blends are the same length and should be changed to create a better mix.

The blending is controlled by the alpha fade brushes which affect the whole of the material shader. To use different values the shader has to be broken down into smaller parts.

An ideal breaking point is between the blends as they both require different alpha fade brushes. The lightmap can go with the top blend stage while the lower layers can be left as before.

As the image to the left shows, the previous two materials are split into three with the same amount of stages as before. The material shaders one and three can now have different alpha fade brushes to produce a short and long blend.
 The Short Straw
The terrain was setup with two brushes per side so that the material shaders had time to develop with gradual alpha fade values. This also makes it easier to create a short blend because the brush cuts are already in place.

Like the image to the left shows, the column of brushes in the middle are grouped together using a 'func_group' entity and have their own unique set of alpha fade brushes.

The material on the top of this blend (number three in the diagram at the top of the page) uses two primary textures and no lightmap stage. This section of terrain will coexist in the same space as the long blend to create the new material shader layout.
 The Long Winding Road Home
The image to the left shows a special column of brushes in the middle that are using a different shader material. This section of the terrain overlaps the previous short blend and needs to be setup differently.

The special brushes are painted with a 'nodraw' texture first on all sides so that the compiler knows these brushes will be used as decal or overlapping surface.

Finally the new material shader (number one from the diagram at the top of the page) is added to the top surface of the brushes. This shader has the blended secondary texture and lightmap stage on top.
 Double Decker Jam
The image to the left shows the new terrain sections moved apart from each other so that it is easier to see what is happening.

The short blend section has an unique set of alpha fade brushes that must be part of a 'func_group' entity. This is to make sure they do not affect any other part of the terrain except this new blend.

Both sections of terrain are placed on top of each other and the order in which they are drawn (by the engine) is specified by the material shaders. To allow these sections to coexist the new part of the long blend is setup with no collision and is transparent.
Below are the two extra material shaders used for the short and long blend sections discussed in the images above. The full set of material shaders used are available in the source files.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
textures/terblend_soc/tut8_sandmoss
{
   qer_editorimage textures/terblend_soc/ter_sandmoss.tga
   q3map_tcGen ivector ( 128 0 0 ) ( 0 128 0 )
   {
      map textures/terblend_soc/ter_sand1.tga
      rgbGen identity
   }
   {
      map textures/terblend_soc/ter_moss2.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
      rgbGen identity
   }
}
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
textures/terblend_soc/tut8_gravel_overlay
{
   qer_editorimage textures/terblend_soc/ivec_gravel1.tga
   q3map_bounceScale 0
   surfaceparm nonsolid
   surfaceparm trans
   surfaceparm nomarks
   polygonOffset
   
   q3map_tcGen ivector ( 128 0 0 ) ( 0 128 0 )
   {
      map textures/terblend_soc/ter_gravel1.tga
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaGen vertex
      rgbGen identity
   }
   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
      rgbGen identity
   }
}

Lines 1-15 : Is the short blend material shader with a familiar one texture blending on top of another. Both stages use 'rgbGen identity' because this material shader is beneath the long blend section which has the lightmap stage.

Lines 16-37 : Is the long blend material shader which is transparent and has no collision. This shader has the lightmap stage because it is positioned on top of everything else.

Lines 19 : Tells the compiler to not use this surface for bounce light.
Lines 20-22 : Marks the surface as no collision, transparent and no decal marks.
Lines 23 : Draw this material shader on top of anything else.
Lines 28-29 : The alpha channel is affected by alpha fade brushes.

The terrain textures are 512 x 512 in size and should use a setting of 256 instead of 128 for the 'q3map_tcGen ivector' command. The lower value makes the textures appear to be double density (0.25 scale in the editor) so they look better for screenshots.

Mememe
Articles 
Level Design -
Creating Terrain -
 2  3  4  5  6  7  - Pg  
Terrain Blending -
 2  3  4  5  6  - Pg  
Rockwall Corridors -
 2  3  4  - Pg  
Rockwall Detail -
 2  3  4  - Pg  
2 Point Clipping -
 2  3  4  - Pg  
Phong Shading -
 2  3  - Pg  
Triggerable Shaders -
RTCW Scripting -
Scripted Doors -
Basic Lift -
Advanced Lift -
Cooking -
Apple Crumble -
Links 
Places -
Func_Msgboard -
Gamasutra -
Lost Garden -
..::Lvl Maps -
Obsessive Pixel -
Strange Design -
Tigsource -
What Games Are -
People -
Ken Beyer -
Chad Bordwell -
Matthew Breit -
Daniel Cook -
Andrew Dunn -
Ford Dye -
Mark Fry -
John Fitzgibbons -
Garth Hendy -
Robert Hodri -
Fred Hooper -
Tadhg Kelly -
Mark Kilborn -
Steven Krzanich -
Nikolai Mochilchock -
Joel McDonald -
Randy Reddig -
Fabien Sanglard -
Benoit Stordeur -
Simon Strange -
Eric Testroete -
Tom Waters -
Andrew Weldon -
Pat Williams -
Personal Info -
LinkedIn -
Moby Games -
GiantBomb -
Garage Games -
Newsground -
Game Artisan -
Tumblr Blog -
RSS Feed -
Archive 
2012 - 2011 -
2010 - 2009 -
2008 - 2007 -
2006 - 2005 -
2004 - 2003 -
2002 - 2001 -
Firefox RSS Feed Valid HTML 4.01 Transitional
Mememe