I’m trying to create some terrain with q3map_alphaMod dotProduct, q3map_tcGen ivector and tcGen vector, but I can’t seem to get the textures aligned to the terrain mesh properly.
What I want to do is have one texture for all near-horizontal faces that blends into another texture for all near-vertical faces. The horizonal faces are projection mapped along the z-axis using q3map_tcGen ivector. The vertical faces are supposed to be projection mapped along the x-and-y-axes using tcGen vector (stage specific).
Problem is that no matter what I do, the vertical face textures seem to deform whenever I try to map it along two axes at the same time. You can see the result in this screenshot (I replaced the vertical face texture with a grid to illustrate my point).

Here’s my shader:
// rock-decay BASE shader
textures/obsidian_terrain/rock-decay-base
{
q3map_forceMeta
q3map_nonPlanar
q3map_shadeAngle 120
//q3map_tcMod rotate 22
//q3map_lightmapAxis z //use on normal non-x'ing terrain mesh only
q3map_lightmapMergable
//q3map_lightmapSample Offset 1.0
q3map_lightmapSampleSize 8 //default 16
}
// rock-decay BLEND shader - blends between horizontal & vertical surfaces
textures/obsidian_terrain/rock-decay-blend
{
q3map_baseShader textures/obsidian_terrain/rock-decay-base
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
q3map_alphaMod dotproduct2 ( 0 0 1 )
qer_editorimage textures/obsidian_terrain/rock-decay03.tga
{
map textures/obsidian_terrain/alpha.tga
//map textures/obsidian_terrain/rock-decay03.tga
tcGen vector ( 0.00390625 0.00390625 0 ) ( 0 0 0.00390625 ) //1/256 = 0.00390625
rgbGen identity
}
{
map textures/obsidian_terrain/rock-decay01.tga
blendFunc blend
alphaGen vertex
rgbGen identity
}
{
map $lightmap
blendFunc filter
rgbGen identity
}
}
I can see why I’m having the problem, but I can’t think of any solutions. Any ideas?
I also tried using two tcGen vector directives in that stage, but it didn’t work, it only uses the first one.


