Page 1 of 1

Decals and fog

Posted: Mon Mar 20, 2006 5:05 pm
by dnky
Has anybody got any experience using decals in conjunction with fog?
I have a problem where the decal is being drawn on top of the fog. Is this another Q3 fog problem or is there a way around it, maybe using sort n? I would normally use sort 6 on a decal shader, but maybe something different when used in fog?

Posted: Mon Mar 20, 2006 5:29 pm
by dnky
just to highlight this:
Decal jump pad with no fog:
Image
Then Decal in the fog:
Image

For these shots I was trying sort 8, which I thought drew behind transparent effects, like water.

Maybe I'm barking up the wrong tree, maybe its the blendFunc in the shader, in that case here is the script:

Code: Select all

textures/dk_geo4/dk_jp
{
	qer_editorimage textures/dk_geo4/dk_jp.tga
	surfaceparm trans
   	surfaceparm nomarks 
	q3map_lightimage textures/dk_geo4/dk_jp_fx.tga
        q3map_surfacelight 50
   	polygonOffset  
  	sort 8 
	nopicmip

	{
		map textures/dk_geo4/dk_jp.tga
		blendFunc GL_ONE GL_ZERO
		alphaFunc GE128
		depthWrite
		rgbGen identity
	}
{
		clampmap textures/dk_geo4/dk_jp_fx.tga
		blendfunc add
		tcMod stretch sin 1 .5 0 .8
		rgbGen wave square .5 .5 .25 1.5
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc GL_DST_COLOR GL_ZERO
		depthFunc equal
	}
}

Posted: Mon Mar 20, 2006 5:53 pm
by Fjoggs
Simply add the decal to a seperate texture, so it wouldn't be a decal?

Posted: Mon Mar 20, 2006 6:56 pm
by dnky
there is that, but being lazy, it was easier to make a single texture I could use on any floor rather than several on different backgrounds.

Posted: Mon Mar 20, 2006 7:25 pm
by Fjoggs
correct, you are lazy! :p

Posted: Mon Mar 20, 2006 8:09 pm
by dnky
lol, I love you too!

Posted: Mon Mar 20, 2006 8:40 pm
by Hipshot
Just make a normal transparent shader with notsolid and apply it on a nodraw brush that is 1U over the ground... why mess with decals?

Posted: Mon Mar 20, 2006 9:03 pm
by dnky
That will be my final resort I think. I need to test whether or not you can get far enough above the jp for doing it that way to cause z-fighting.

Posted: Mon Mar 20, 2006 9:08 pm
by Hipshot
I've done it on my entire map, all windows, metal plates that is under my weapons, no zfight there, you don't get zfight in 32bpp if you don't build a texture into another on the same plane.
You would get zfight with you way also, if you were using 16bpp.

(the map http://www.quake3world.com/forum/viewtopic.php?t=18126 check the windows and that)

Posted: Tue Mar 21, 2006 4:33 pm
by dnky
yep thats true for sure. I tend to be obsessive about things looking right on all settings, even 16bit. Maybe nobody even looks at Q3 under 16bit mode anymore.

Posted: Fri Mar 24, 2006 11:15 am
by codey-
ydnar posted a trick using a inverse shader and the actually texture also inverted which he called 'Inverse multiplicative shadows'. Thread is here - scroll down a bit - but since he lost control over shaderlab.com the images are missing:

Decal tricks

Maybe that can help you

Posted: Fri Mar 24, 2006 11:30 am
by Shallow
I did make a post on MC a while back explaining the same thing, the images for that should still be up. In fact I'm pretty sure donks has used it in at least one of his maps, is that right guv?

Unfortunately, the inverse blend trick is only really useful for stuff like stains which would actually need to be blended with the texture underneath, it wouldn't really work with something that needs to have opaque areas like a jump-pad.

Posted: Fri Mar 24, 2006 3:44 pm
by dnky
yep I have. You're both right. That works, but as Shallow says it makes the texture semi-trans and blends with the underlying texture. Dumping polygonoffset works in this case, even at 16bit you cant see any z-fighting as you cant get far enough away from the jump pad for LOD to have an effect.