Blending Issue


(d3coy) #1

What causes this and what might fix it?

As you can see the grass and sand textures are not blending as they should… I have made sure all vertices match, proper alpha fade brushes, seems to be something with the angle?


(Shaderman) #2

Post the shader you’re using.


(]UBC[ McNite) #3

and plz post a screenie that s closer and brighter, i can’t really see much


(d3coy) #4
// ======================================================================
// DotProduct2 Terrain blending
// ======================================================================


textures/oc_escort/ter_grassdirt
{
        qer_editorimage textures/oc_escort/ter_grassdirt.tga
	
	q3map_nonplanar
	q3map_shadeangle 150
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 )
	
	{
		map textures/oc_escort/oc_greengrass01.tga	// Primary
		rgbGen identity
	}
	{
		map textures/oc_escort/oc_dirt.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/oc_escort/ter_grassgrass
{
        qer_editorimage textures/oc_escort/ter_grassgrass.tga
	
	q3map_nonplanar
	q3map_shadeangle 150
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 )
	
	{
		map textures/oc_escort/oc_greengrass01.tga	// Primary
		rgbGen identity
	}
	{
		map textures/oc_escort/oc_greengrass01.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/oc_escort/ter_roaddirt
{
        qer_editorimage textures/oc_escort/ter_roaddirt.tga
	
	q3map_nonplanar
	q3map_shadeangle 150
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 )
	
	{
		map textures/oc_escort/oc_road01.tga	// Primary
		rgbGen identity
	}
	{
		map textures/oc_escort/oc_dirt.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/oc_escort/ter_sanddirt
{
        qer_editorimage textures/oc_escort/ter_sanddirt.tga
	
	q3map_nonplanar
	q3map_shadeangle 150
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 )
	
	{
		map textures/oc_escort/oc_sand_gravels_bright.tga	// Primary
		rgbGen identity
	}
	{
		map textures/oc_escort/oc_dirt.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/oc_escort/ter_grasssand
{
        qer_editorimage textures/oc_escort/ter_grasssand.tga
	
	q3map_nonplanar
	q3map_shadeangle 150
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 )
	
	{
		map textures/oc_escort/oc_greengrass01.tga	// Primary
		rgbGen identity
	}
	{
		map textures/oc_escort/oc_sand_gravels_bright.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/oc_escort/ter_dirtdirt
{
        qer_editorimage textures/oc_escort/ter_dirtdirt.tga
	
	q3map_nonplanar
	q3map_shadeangle 150
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 )
	
	{
		map textures/oc_escort/oc_dirt.tga	// Primary
		rgbGen identity
	}
	{
		map textures/oc_escort/oc_dirt.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/oc_escort/ter_dirtsand
{
        qer_editorimage textures/oc_escort/ter_dirtsand.tga
	
	q3map_nonplanar
	q3map_shadeangle 150
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 )
	
	{
		map textures/oc_escort/oc_dirt.tga	// Primary
		rgbGen identity
	}
	{
		map textures/oc_escort/oc_sand_gravels_bright.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
	}
}

(CooperHawkes) #5

Why do you guys always add “alphaFunc GE128” ? This is not sexy, especially if you do not have a properly designed alpha channel in your secondary texture.
I know, Sock also has this line in his shaders… but he knows what he is doing :wink: In most other cases you might get the best/most performant results with alphaFunc GT0… of course, mileage may vary :wink:


(Flippy) #6

well, most of the newbie mappers here don’t have a clue what “alphaFunc GE128” or “GT0” means :wink:


(carnage) #7

well, most of the newbie mappers here don’t have a clue what “alphaFunc GE128” or “GT0” means

thats is why they invented the search button. if i remeber i went on a massive rant to explain all the GT functions


(d3coy) #8

so post a link to that as a possible fix… kthx… im posting not about what that does, but why i might be having this issue in my blending… if that is a possible cause, then tell me that so I can search or try to figure it out… thanks for your help. And as far as noobie mappers, well… look at your join date vs others who are on here!!! Ive been mapping for almost 3 years now… thxs


(Shaderman) #9

I guess this is the thread carnage was talking about.

http://splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=15080

Replacing GE128 with GT0 (like CooperHawkes said), lowering the last value of q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 ) and the alpha channels for the secondary textures are things you might need to change to get smooth (and not that flat) blending (point 1):

Does the brush at point 2 need a brush cleanup?


(CooperHawkes) #10

i didn’t mean to offend somebody… i was just wondering why everybody uses this “alphafunc” thingie nowadays :slight_smile:

alphafunc simply cuts off everything that falls below a certain alpha value (in case of GE128 everything below 128 is discarded)… the effect is that your blended terrain won’t have a continuous blend but a sharp “cut” where both textures are blended 50 percent (which is the effect i can observe in your image, see Shaderman [1]).

regarding the bright “marks”, i would say that there is a duplicate brush… as Shaderman already pointed out [2].


(d3coy) #11

no duplicate brush… ive check ed this many times now. No offense was taken… i just hate this issue i have and have had it many times before when using this type of blending. I can correct the issue by making the brushwork more even there.

q3map_alphaMod dotproduct2 ( 0.0 0.0 0.85 ) I changed this to .85 and it got rid of the brightspot, but made the blends look choppy. Im at a loss on what else to do. I will try the GE128 change next.


(carnage) #12

Replacing GE128 with GT0

imo a better solution is just to remove the alphafunc altogether and just leave the blending to the shader command rather than using a shap alpha rendering cutoff point. its strage why sock used a command that creates such a sharp edge in a shader for something supost to look natural like terrain. but hes a pro and know whats hes doing i gess


(CooperHawkes) #13

Well… GT0 does not do any harm… the visual result is the same as omitting the line completly. But GT0 can save you some fill rate if you have dot product (2) blended terrain.


(]UBC[ McNite) #14

@ carnage: sock used 128 because of the alphamap he was using. Have a close look at the simland boxmaps and you ll see why it works as “smooth”: its not smooth but a lot of small areas of his clay texture that blend over all his other textures.
If you don’t have that kind of secondary tex, 128 is not your friend.

decoy, I d also get rid of the dotproduct. Check out the warbell shaders for terrain, they were done completely without dotproduct. With just the blendmarkers I was able to control the blending very well, and create fine smooth blending where and how I wanted it.


(carnage) #15

i get why he did it since he wanted to create the impresion of rocks/pebels etc actuly being over the other texture so you would get the sharp contrast between the two textures rather than 50% opaque pebel but because of texture resolutions etc it doest work out quite as nicely. and because the pebels are not bumpmaped they tend to look very flat and very unpebel like and imo dont give the desired effect but i can see the logic for ariving at the solution. but at the end of the day i think its alot about how you actuly implement it into each individual map