Page 1 of 1

Shader problem

Posted: Sun Jul 31, 2011 7:16 pm
by Noruen
Hi!

I have a problem with shaders.See picture - It seems like falling water and watersplash is influenced by water lightmap stage, but both (falling water and splash) are different brushes and shaders. I can't solve, why:(

Image

Code: Select all

textures/noruen_penumbra/PuWaterSteady
{
	qer_editorimage textures/noruen_penumbra/PuWater1.tga
	qer_trans 0.9
	q3map_globaltexture
	surfaceparm trans
	surfaceparm nomarks
	surfaceparm water

	cull front
	{
		map $lightmap
		tcGen environment
		//tcMod scale 0.1 0.1
		rgbGen const ( 0.25 0.25 0.25 )
		blendFunc gl_one gl_one
	}
	{
		map textures/noruen_penumbra/PuWater2.tga
		tcmod scale 2.25 0.75
		tcmod scroll 0.1 0.15
		rgbGen wave sin 1 0.1 0.5 0.75	//func, amplitude, phase, freq
		blendFunc add
	}
	{
		map textures/noruen_penumbra/PuWater2.tga
		tcmod scale -1.5 0.75
		tcmod scroll -0.1 -0.15
		rgbGen wave sin 1 0.1 0 0.75	//func, amplitude, phase, freq
		blendFunc add
	}
	{
		map $lightmap
		blendFunc filter
		rgbGen identity
	}
}
and waterfall shader:

Code: Select all

textures/noruen_penumbra/PuWaterFlow			//Falling water
{
	qer_editorimage textures/noruen_penumbra/PuWaterFlow.tga

	surfaceparm trans
	surfaceparm nonsolid
	surfaceparm nomarks

	cull disable
	deformVertexes autosprite2
	{
		map textures/noruen_penumbra/PuWaterFlow.tga
		tcmod scale 0.5 1
		tcmod scroll 3 0
		rgbGen const ( 0.1 0.1 0.1 )
		blendFunc add
	}
	{
		map textures/noruen_penumbra/PuWaterFlow2.tga
		tcmod scale 0.75 1
		tcmod scroll 3.6 0
		rgbGen const ( 0.1 0.1 0.1 )
		blendFunc add
	}
}
Thank you.

Re: Shader problem

Posted: Mon Aug 01, 2011 1:48 am
by obsidian
Hard to tell from the screenshot and description, but here are a couple of general things that you should look into:

I'm not sure if there is any particular reason why you are using "cull front", perhaps you mean to use "none" or "disable".

What's probably causing your issue is that you really shouldn't have 2 lightmap stages. You can test this by commenting out the first lightmap stage and reloading the map. I think what you meant to do is replace the first lightmap stage with a standard texture map of something that looks like a reflection. "tcGen environment" is used to add a distortional environmental mapping to the texture stage to simulate water or metallic reflections.

Re: Shader problem

Posted: Mon Aug 01, 2011 7:06 am
by Noruen
I tried your suggestion, but it doesn't work. Problem is, that when splash and waterfall are textures "blendfunc ADD", they seem to be less visible in parts, when that water shader is behind them (on picture you can see the white border of splash, but above the water t is almostly invisible). I deleted lightmap stage (both) and it works now. But I need lightmap :(

Re: Shader problem

Posted: Mon Aug 01, 2011 8:25 am
by dONKEY
Why does water need lightmapping?

Re: Shader problem

Posted: Mon Aug 01, 2011 8:58 am
by Noruen
Because it is dirty water where shadows are visible and because without it it is too bright.

Re: Shader problem

Posted: Mon Aug 01, 2011 9:15 pm
by Theftbot
Cant you use a water/fog shader?