Shader problem

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Shader problem

Post 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.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Shader problem

Post 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.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Re: Shader problem

Post 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 :(
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Shader problem

Post by dONKEY »

Why does water need lightmapping?
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Re: Shader problem

Post by Noruen »

Because it is dirty water where shadows are visible and because without it it is too bright.
User avatar
Theftbot
Posts: 483
Joined: Thu Oct 08, 2009 4:03 am

Re: Shader problem

Post by Theftbot »

Cant you use a water/fog shader?
Post Reply