terrain - blending problem


(Beza) #1

i have this problem:

some brushes have bad blending and i cant figure out why is that…

shader for compiler:


textures/rail/common/terrain_rail
{
	q3map_terrain
	surfaceparm nodraw
	surfaceparm nomarks
 	surfaceparm nolightmap
}

textures/terrain/rail_base
{
	q3map_lightmapsampleoffset 8.0
	q3map_lightmapaxis z
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
}

textures/terrain/rail_0
{
	q3map_baseshader textures/terrain/rail_base
	{
		map textures/test_map/ground_old.jpg
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/terrain/rail_1
{
	q3map_baseshader textures/terrain/rail_base
	{
		map textures/rail/railway.jpg
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/terrain/rail_0to1
{
	q3map_baseshader textures/terrain/rail_base
		{
		map textures/test_map/ground_old.jpg
        	}
	{
		map textures/rail/railway.jpg
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphaGen vertex
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

textures/terrain/rail_1to0
{
	q3map_baseshader textures/terrain/rail_base
	{
		map textures/rail/railway.jpg
	}
	{
		map textures/test_map/ground_old.jpg
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphaGen vertex
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

shader for game engine:


[textures/terrain/rail_0]
[textures/terrain/rail_0_p_1]
param1=map textures/test_map/ground_old.jpg
param2=rgbgen vertex

[textures/terrain/rail_1]
[textures/terrain/rail_1_p_1]
param1=map textures/rail/railway.jpg
param2=rgbgen vertex

[textures/terrain/rail_0to1]
[textures/terrain/rail_0to1_p_1]
param1=map textures/test_map/ground_old.jpg
param2=rgbgen vertex
[textures/terrain/rail_0to1_p_2]
param1=map textures/rail/railway.jpg
param2=rgbgen vertex
param3=alphagen vertex
param5=blendfunc gl_src_alpha gl_one_minus_src_alpha

[textures/terrain/rail_1to0]
[textures/terrain/rail_1to0_p_1]
param1=map textures/rail/railway.jpg
param2=rgbgen vertex
[textures/terrain/rail_1to0_p_2]
param1=map textures/test_map/ground_old.jpg
param2=rgbgen vertex
param3=alphagen vertex
param5=blendfunc gl_src_alpha gl_one_minus_src_alpha

terrain has 2 layers (using indexmap)

… its not a Q3A engine (its our own engine), however it supports almost all standards of Q3A - old vertexlight terrain build with q3map work fine, problem appears now when i use lightmap terrain (q3map2)

i would be thankful for any ideas…


(Fracman) #2

Did you try to apply the working blending shader to the other side too?
Perhaps it blends correctly only in one direction.
Which method are you using in fact?
Can you show a screenshot of the editor, too, pls?


(Beza) #3

well, i use valve hammer insted of radiant (donl laught at me ;), export map and then convert it to *.map format compatible with q3map2

and the only way how to blend terrain using hammer is with index map (at least i dont know any other way) - each color on bitmap represents a single layer (so i have 2color bitmap)

terrain looks like this:

"classname" "func_group"
"_layers" "2"
"_shader" "terrain/ruin"
"_indexmap" "terrain/rail.bmp"

where rail.bmp is my 2-color index map


(Detoeni) #4

Try using a pcx instead of bmp.

http://splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=4315&start=0&postdays=0&postorder=asc&highlight=pcx+bmp&sid=9be93f45975afe1a8647e76db63cb806

I would have found a diffrent way to add the track layer my self, using terrain for this feature seams alot of work.


(Beza) #5

i tried *.pcx, but same result :frowning:

here you can see two results made by two different index maps (both pcx):


left one is almost right, but i have only half of the railway

i suppose this cant be caused by different sizes of blocks in terrain func_group, or? :

i follow ydnars advise and make pcx texture with a pixel more then number of blocks is (terrain is made of 21x14 boxes, so texture is 22x15 pixels)


(Detoeni) #6

Its due to the verts on of the terrain not matching/lining up with the pcx/bmp.

This might be of use:
http://www.planetquake.com/simland/pages/articles/terrain1_1.htm