polygonOffset and marks


(FSF-Moses) #1

I have lights added in my map which use the polygonOffset on the side with the light-texture.
Here’s the shader I use:


textures/moses_lights/ceil1_38_1000
{
	qer_editorimage textures/moses_lights/ceil1_38.tga
	polygonOffset 
	surfaceparm nomarks 
	q3map_surfacelight 1000
	{
		map $lightmap
		rgbGen identity
	}
	{
		map textures/moses_lights/ceil1_38.tga
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity
	}
	{
		map textures/moses_lights/ceil1_38.blend.tga
		blendfunc GL_ONE GL_ONE
	}
}

It works very great on the part of reducing the triscount in those areas but there’s one major drawback :frowning:

When there are impacts of weaponfire I get some kind of texture-errors which look like overdraw. I tried to add surfaceparm nomarks bot no avail.

Is there some kind of extra keyword which I need to get rid of this or do I have to think of something else?

The only solution I can think of is to extend those brushes (all sides but one with nodraw) 1 unit outside the surrounding brush.
My question on this solution is: Does this one unit thing affect the bot navigation or is this no problem.
The nodraw shader has this inside:


textures/common/nodraw
{
	surfaceparm nodraw
	surfaceparm nolightmap
	surfaceparm nonsolid
	surfaceparm trans
	surfaceparm nomarks
}

So I was thinking of that solution of extending that brush a bit outside and hoping this doesn’t affect the botnavigation. In other words: no need for covering those places with a thin brush with botclip

What are your thoughts/comments/suggestions on this?


(ydnar) #2

Decals z-fight with bullet/scorch marks because they’re both using polygonOffset.

An alternative solution is to use alpha-blended decals, which don’t write to the z-buffer, and don’t have this problem:


textures/moses_lights/ceil1_38_1000
{
	qer_editorimage textures/moses_lights/ceil1_38.tga
	
	q3map_surfacelight 1000
	
	surfaceparm nomarks
	surfaceparm nonsolid	// so it matches nodraw
	surfaceparm pointlight	// to suppress lightmap
	surfaceparm trans		// so it matches nodraw
	
	polygonOffset
	
	sort banner				// to get it to draw after walls
	
	// note: the alpha channel of this image must be white
	// or the mask of the light shape you desire
	{
		map textures/moses_lights/ceil1_38.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		rgbGen vertex
	}
	{
		map textures/moses_lights/ceil1_38.blend.tga
		blendfunc GL_ONE GL_ONE
		rgbGen identity
	}
} 

With this shader you can have masked/knocked out areas, shaping the light, instead of just a regular block/rectangle.

y


(FSF-Moses) #3

Thank you very much ydnar!
It indeed works! you rock!

Oh, before I forget: What documention on shaders and related could you advice me as being a n00bie?

Thanks in advance