Vertical Texture Blending


(Infernis) #1

I’m messing around with creating realistic looking terrain and blending textures. Thanks to Sock his lovely articles I managed to get it to work. Not precisely like he did it, but hell it works for me.

Only problem is that as soon as I apply my method [well not mine, Donkey explained it to me] to vertical brushwork it looks stretched.

Let’s illustrate a bit. This is a shot from my test map. As you can see the ground looks normal but the rockwall looks stretched.

This is the shader I used for it:

textures/inf_dm1/moss_mud_blend
{
//qer_editorimage textures/inf_dm1/moss_mud_blend.tga
q3map_lightimage textures/inf_dm1/moss.tga
q3map_nonplanar

q3map_shadeAngle 179
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
q3map_lightmapAxis z

{
map textures/inf_dm1/mud.tga
alphaFunc GE128
rgbGen identity
}
{
map textures/inf_dm1/moss.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbGen identity
alphaGen vertex

}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
}

textures/inf_dm1/moss_rock_blend
{
//qer_editorimage textures/inf_dm1/moss_rock_blend.tga
q3map_lightimage textures/inf_dm1/moss.tga
q3map_nonplanar

q3map_shadeAngle 179
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
q3map_lightmapAxis z

{
map textures/inf_dm1/rock.tga
alphaFunc GE128
rgbGen identity
}
{
map textures/inf_dm1/moss.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbGen identity
alphaGen vertex

}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
}

Now I know it has to do with the ivector thingie. I just don’t know where to ad it and which values I should use. Any suggestions ?


(obsidian) #2

http://shaderlab.com/q3map2/shader_manual/ch3.html#tcgen

q3map_tcGen ivector sets a (inverse) vector from which the texture is projected from. Right now, you are instructing Q3Map2 to project the texture’s s-axis to be aligned with the world x-axis and the texture’s t-axis to be aligned with the world y-axis, repeating every 256 game units in both directions. So you are projecting the texture directly downwards along the Z-axis.

More specifically, the first set of values sets the vector for the texture’s s-axis and the second set of values sets the vector for the texture’s t-axis. Depending on the direction that you want to project the texture, you will need to change the s and t vectors so that the texture is being projected against the side of those brushes rather than from the top.

Also, try commenting out q3map_tcGen ivector completely and letting Q3Map2 implicitly set the texture co-ordinates using the normal box texture projection method. It may yield better results depending on the look that you’re going for.


(The Wanderer) #3

http://home.comcast.net/~saberpeak/website/tutorials/part1.html