Terrain flashing 'black' occasionally


(Disgruntled Goat) #1

Hey guys,

I am new to the whole shader/terrain process. I have a little problem with some terrain, probably a shader issue. After compiling with the -light portion of the compile, my terrain will ‘flash’ from black to the correct texture when looked at from certain angles. When compiled overbright, this doesn’t happen. Here is the shader I am using. Thanks a lot for any help.

textures/popbocage/terrain_0
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/temperate_sd/grass_path1.tga
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
tcGen lightmap
}
}

textures/popbocage/terrain_1
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/temperate_sd/rock_ugly_brown.tga
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
tcGen lightmap
}
}

textures/popbocage/terrain_2
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/pop_ground/jomamamudv1.tga
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
tcGen lightmap
}
}

textures/popbocage/terrain_3
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/egypt_floor_sd/sandy_dirt_01.jpg
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
tcGen lightmap
}
}

textures/popbocage/terrain_4
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/temperate_sd/grass_path1.tga
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
tcGen lightmap
}
}

textures/popbocage/terrain_5
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/temperate_sd/dirt3.tga
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
tcGen lightmap
}
}

textures/popbocage/terrain_0to1
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/grass_path1.tga
}
{
	map textures/temperate_sd/rock_ugly_brown.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_0to2
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/grass_path1.tga
}
{
	map textures/pop_ground/jomamamudv1.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_0to3
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/grass_path1.tga
}
{
	map textures/egypt_floor_sd/sandy_dirt_01.jpg
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_0to4
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/grass_path1.tga
}
{
	map textures/temperate_sd/grass_path1.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_0to5
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/grass_path1.tga
}
{
	map textures/temperate_sd/dirt3.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_1to2
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/rock_ugly_brown.tga
}
{
	map textures/pop_ground/jomamamudv1.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_1to3
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
{
map textures/temperate_sd/rock_ugly_brown.tga
}
{
map textures/egypt_floor_sd/sandy_dirt_01.jpg
alphaGen vertex
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
tcGen lightmap
}
}

textures/popbocage/terrain_1to4
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/rock_ugly_brown.tga
}
{
	map textures/temperate_sd/grass_path1.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_1to5
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/rock_ugly_brown.tga
}
{
	map textures/temperate_sd/dirt3.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_2to3
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/pop_ground/jomamamudv1.tga
}
{
	map textures/egypt_floor_sd/sandy_dirt_01.jpg
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_2to4
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/pop_ground/jomamamudv1.tga
}
{
	map textures/temperate_sd/grass_path1.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_2to5
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/pop_ground/jomamamudv1.tga
}
{
	map textures/temperate_sd/dirt3.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_3to4
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/egypt_floor_sd/sandy_dirt_01.jpg
}
{
	map textures/temperate_sd/grass_path1.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_3to5
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/egypt_floor_sd/sandy_dirt_01.jpg
}
{
	map textures/temperate_sd/dirt3.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain_4to5
{
q3map_lightmapsamplesize 64
q3map_lightmapaxis z
q3map_texturesize 512 512
q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

{
	map textures/temperate_sd/grass_path1.tga
}
{
	map textures/temperate_sd/dirt3.tga
	alphaGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
	map $lightmap
	blendFunc GL_DST_COLOR GL_ZERO
	tcGen lightmap
}

}

textures/popbocage/terrain.vertex
{
{
map textures/temperate_sd/grass_path1.tga
rgbGen vertex
}
}


(Java.Lang) #2

Try dropping your tcgen lightmap parameter on your blended shaders.


(Disgruntled Goat) #3

Naw, no luck with that Java, it’s still flashing black from certain angles. Thanks for the idea though.


(MadJack) #4

Z fighting?

Make sure you didn’t accidently copy your terrain, or part of it. CTRL-ALT Left Click, H. That’ll hide the group and hide it. From there you’ll see if there’s another layer of terrain…

HTH


(Moonkey) #5

Could be a problem with your alphamap, with too many colours meeting at the same point. If a triangle needs 3 textures to be drawn on it I think it can go black like you’re saying.


(Disgruntled Goat) #6

Thanks guys, good ideas but still didn’t work. There are no duplicate terrain brushes and the terrain is ‘flashing’ in every area, sometimes when only one texture is inhabiting it.
Here are some screens. At one angle, the terrain is black, then move slightly and the correct texture shows.


(MadJack) #7

Never seen that behavior in ET, only inside Easygen. In ET it’ll default to one of the image that is used.


(MadJack) #8

From the look of the pics, it seems it’s only 1 terrain texture that is doing it. Which one is it? Maybe checking the particular shaders regarding that terrain texture and those around it will yield some results.


(ratty redemption) #9

I agree with MadJack, from the pics it looks like a shader problem with one particular stage.

are you using custom tex in your shader? if so maybe one of them is corrupt, you could test this by temporally replacing the suspect tex, with another one using the same name.

another test, would be to backup your alphamap (indexmap) and then manually change the entire color of it to just one of it`s index colors, eg, all grass, or all dirt …then after compiling, if the whole of your terrain is playing up, you know it was that shader stage, and you can replace your original alphamap, as that was really just used to test the shaders.

edit: I can also see what Java was thinking as it sounds like the lightmap is playing up, but what would be causing that is weird, since you don`t appear to be using any styled (flickering) lighting.

you could also try one of the latest q3map2 compilers and see if that fixes the problem, although I`d still like to know how your getting this bug in the first place.


(badong) #10

on a completely unrelated note…why aren’t you using a terrain_base shader for your common paratmeters instead of repeating them in every shader.


(Disgruntled Goat) #11

Doh!! I think I tracked down the problem. Without realizing it, shaders 0 and 4 were the same grass path texture and I think were cancelling each other out with the black flashes. Thanks for the help guys, much oblige!!


(MadJack) #12

Dunno if you fixed your problem but (if it’s not fixed) check if there’s no two distinct textures using the same color index. That would probably give the result above since both would try to get drawn at the same time, at the same place resulting to something close to Z-fighting.


(TFate) #13

I get this black flashing all the time on official ET maps, I always ignored it and thought it had something to do with my video card (which tbh is crap). I think it has nothing to do with corrupted alphamaps or shader problems.


(MadJack) #14

Yeah it’s very possible that with low system settings you’d get that behavior. Goat should definitively check that.


(ratty redemption) #15

could it have something to do with 16bit vs 32 bit mode?


(LaggingTom) #16

I’m pretty sure it’s biliniar filter problems. Switch to tri.


(Disgruntled Goat) #17

Thanks again guys, for the great ideas. I’ll check and try the settings thing. My card is a higher end card so it should be fine.