News Design Materials Articles
 Creating Terrains - Patchwork Shaders  Page 4 of 7
Patchwork Shaders The Alpha Fade system uses a special set of shaders which are only visible in the editor. These textures are colour coded and have a percentage number which indicates the level of the alpha transparency.

The shader file supplied with the example map for this article has 6 standard defined percentage values of 0,25,50,75,85 and 100. Other values are possible as the alpha range is 0 to 100 percent. (Actual shader values are 0.0 to 1.0)

Certain alpha values work better than others, but ultimately it always depends on the alpha channel of the texture and the DotProduct2 parameters used.

Good additional values to try are 70,80 and 90 as they produce nice fine blends ideal for gradual slopes or borders.
 Alpha Fade Shader explained
01
02
03
04
05
06
07
08
09
textures/terrain_example/alpha_000	// Primary texture ONLY
{
	q3map_alphaMod volume
	q3map_alphaMod set 0
	surfaceparm nodraw
	surfaceparm nonsolid
	surfaceparm trans
	qer_trans 0.75
}
  • Line 1 : the name of the shader prefixed with an alpha_ to help with sorting in the texture window. Remember these shaders can go anywhere you like, but for this example I have included them in the same directory as the rest of the resources.

  • Line 3 : Tells the compiler that this is a special Alpha Fade Shader. A brush must use this shader on all sides otherwise it will not work correctly. This is a volume function similar to water, fog etc.

    All vertex points enclosed within a brush painted with this shader will have their alpha values changed. This process can also be fine tuned by the use of  func_group entities. Meaning that the Alpha Fade function will only try and affect brushes which are included in the same func_group and nothing else.

  • Line 4 : Tells the compiler what value to set the alpha channel fade to. This is a specific value and will discard any previous value found. The possible range of values which can be used is 0.0 to 1.0.

  • Lines 5-8 : Various shader commands to remove this shader surface from the game and set the transparency of the shader in the editor.

    Special note: All Alpha Fade brushwork can be filtered in the editor with ALT+4 (Translucent)
 Back on the path
Back on the path The terrain shader is setup with the moss as the primary texture (alpha 0) and the mud as secondary. (alpha 100) The Alpha fade editor brushes are clearly marked to help see which is primary and secondary.

The first problem is that the path lacks any kind of definition, so use the Alpha Fade brushes as poles and plot out a route. remember to use the alpha 100 shader as its the secondary texture which is required.

Once the initial path line is in place, then check to see what the terrain looks like in game. Always try to allow the DotProduct2 system to create the blends first and then fine tune the terrain afterwards. Otherwise you will end up with a lot of Alpha Fade Brushes and not much organic looking blending.
Mememe
Articles 
General -
Terrain Blending -
 2  3  4  5  6  7  - 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  
RTCW -
Scripted Doors -
Basic Lift -
Advanced Lift -
Links 
Places -
Crytek -
Func_Msgboard -
Indy Developers -
Indy Portal -
Level Makers -
..::Lvl Maps -
Mememe -
Q3 World -
Raven Software -
Splashdamage -
People -
Chris Auty -
Martin Badowsky -
Ken Beyer -
Chad Bordwell -
Nicolas Bouvier -
Matthew Breit -
Benjamin Darling -
Ford Dye -
Vegard Fjogstad -
Fred Hooper -
Nikolai Mochilchock -
Randy Reddig -
Benoit Stordeur -
Tom Waters -
Andrew Weldon -
Pat Williams -
Info -
LinkedIn -
Moby Games -
Indy Profile -
Facebook -
Feral by Night -
Archive 
Aug - Dec 2008 -
Jan - Jul 2008 -
2007 -
2006 -
2005 -
2004 -
2003 -
2002 -
Firefox 3 Valid HTML 4.01 Transitional
Mememe