News Design Artwork Photos Articles
Creative Commons All use of my digital work is covered by this Creative Commons Deed.
Please do not use any of my work for commercial purposes, thank you.
 Terrain Blending (5 of 6) Previous Page Next Page
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 } }

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.

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 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.

Line 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.

Line 23 Draw this material shader on top of anything else.

Line 25 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.

Lines 28-29 The alpha channel is affected by alpha fade brushes.

Prev Page Next Page
Mememe
Articles 
Level Design -
GameDev Advice -
Creating Terrain -
Terrain Blending -
Rockwall Corridors -
Rockwall Detail -
2 Point Clipping -
Phong Shading -
3D Puzzle Scripting -
Triggerable Shaders -
RTCW Scripting -
Scripted Doors -
Basic Lift -
Advanced Lift -
Cooking -
Apple Crumble -
This site has been cobbled together by Simon O'Callaghan
Contact Information: Simon O'Callaghan
All content is Copyright © 2000-2024
Hosted by ApisNetwork