Terrain blending


(Xterm1n8or) #1

Hi all

I have a couple of questions with dotproduct2 blending.

Firstly, although it SEEMS to work ok, when you create a new channel, what should the opacity and colour be?
Mine was 100% black. I then copy and pasted my black/white image into the channel.

Also, for my textures to look proper in game, i need to v/hscale it to -0.2000. I can’t seem to be able to do the same with my dirt/grass texture. It remains at the default size causing it to look more like terain bluring rather than blending. I have also noticed it is mirrored, even though when i caulk it, its all the same.

Many thanks :slight_smile:

P.s This is my .shader:

textures/new_textures/dirt_grass
{
qer_editorimage textures/new_textures/dirt_grass.tga

q3map_nonplanar
q3map_shadeangle 120
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
q3map_alphaMod dotproduct2 ( 0.0 0.0 0.75 )
{
	map textures/new_textures/dirt.tga	// Primary
	rgbGen identity
}
{
	map textures/new_textures/grass.tga	// Secondary
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
	alphaFunc GE128
	rgbGen identity
	alphaGen vertex
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	rgbGen identity
}

}

textures/new_textures/alpha_000 // Primary texture ONLY
{
q3map_alphaMod volume
q3map_alphaMod set 0
surfaceparm nodraw
surfaceparm nonsolid
surfaceparm trans
qer_trans 0.75
}

textures/new_textures/alpha_075
{
q3map_alphaMod volume
q3map_alphaMod set 0.75
surfaceparm nodraw
surfaceparm nonsolid
surfaceparm trans
qer_trans 0.75
}

textures/new_textures/alpha_100 // Secondary texture ONLY
{
q3map_alphaMod volume
q3map_alphaMod set 1.0
surfaceparm nodraw
surfaceparm nonsolid
surfaceparm trans
qer_trans 0.75
}

I also have in textures/new_textures:

1 dirt image (512x512) 32bit.tga
1 dirt grass (512x512) 32bit.tga
1 dirt/grass editor image (64x64) 24bit.tga
and 3 alpha images (00, 75, 100)


(Xterm1n8or) #2

I’m still not sure if i’m doing the alpha bit right, but as regards to the second bit i had a similar problem.

I made grass/foliage but the actual texture was again too big and blurred. Then i came across:

q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 ),
setting this to 128 did the trick. I also put this on for grass and dirt. I no longer have to scale the textures every time i place them. Cool!

As this line is already in the grass/dirt shader, i played about with it, but it doesnt seem to do anything. Does anyone know how to scale this blended texture. Without this bit looking right, i cant really tell if i’m doing the first bit right.

Many thanks.


(Wezelkrozum) #3

try to add this:
tcModscale .5 .5 //scale of x and y as


(Xterm1n8or) #4

Thanks wezelkrozum,

Finally managed to get it working. It had alot to do with the size of the editor image. Thought it was just for the editor, didnt realize the size would make a difference.

The only thing left now is that ive noticed the blended texture is mirrored. Does anyone know how to flip it the right way?

Many thanks.

Ps The actual blending works also, so very happy. Still mirrored though.