Page 1 of 1

Combine water and mirror shader

Posted: Sat Mar 06, 2010 12:01 am
by cityy
Recently I was wondering if it was possible to have a water texture that gives you some kind of mirror effect.

Here is the water shader I am using in q3ct4 - it is basically the same as IDs water shader just adjusted to the map:

Code: Select all

textures/q3ct4/water
	{
		qer_editorimage textures/liquids/pool3d_3.tga
		qer_trans .5
		q3map_globaltexture
		surfaceparm trans
		surfaceparm nonsolid
		surfaceparm water
		q3map_surfacelight 0
		q3map_lightimage textures/q3ct4/watercolor.tga
		nopicmip
		
		cull disable
		deformVertexes wave 64 sin .5 .5 0 .5	
	
		
		{ 
			map textures/liquids/pool3d_5.tga
			blendFunc GL_dst_color GL_one
			rgbgen identity
			tcmod scale .5 .5
			tcmod transform 1.5 0 1.5 1 1 2
			tcmod scroll -.05 .001
		}
	
		{ 
			map textures/liquids/pool3d_6.tga
			blendFunc GL_dst_color GL_one
			rgbgen identity
			tcmod scale .5 .5
			tcmod transform 0 1.5 1 1.5 2 1
			tcmod scroll .025 -.001
		}

		{ 
			map textures/liquids/pool3d_3.tga
			blendFunc GL_dst_color GL_one
			rgbgen identity
			tcmod scale .25 .5
			tcmod scroll .001 .025
		}	

		{
			map $lightmap
			blendFunc GL_dst_color GL_zero
			rgbgen identity		
		}
}
And here IDs mirror shader:

Code: Select all

textures/sfx/bugmirror
{
	qer_editorimage textures/sfx/mirrorkc.tga
	surfaceparm nolightmap
	portal
	{
		map textures/common/mirror1.tga
		blendfunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
		depthWrite
	}
	{
		map textures/sfx/mirrorkc.tga
		blendFunc add	
		depthfunc equal
	}
}
I tried to merge them but I wasn't able to manage it for some reason - I always messed up the water look. Anyone has an idea?

Re: Combine water and mirror shader

Posted: Sat Mar 06, 2010 1:32 am
by ^Ghost
yea i made a shader like this in one of my maps.

Code: Select all

textures/ghost-random/calm_mirror1_turb
{	
	qer_editorimage textures/ghost-custom/pool3d_6f.tga
	surfaceparm nolightmap
	surfaceparm nonsolid
	surfaceparm trans
	surfaceparm water
	deformVertexes wave 64 sin 0.25 0.25 0 0.5 
	qer_nocarve
	q3map_surfacelight 50
	portal

	{
		map textures/ghost-custom/pool3d_6f.tga
		blendfunc add
		rgbGen identity
		tcMod scroll 0.05 0.05
		tcMod turb 0.2 0.1 0.1 0.2
	}
	{
		map textures/common/mirror1.tga
		blendfunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
		depthWrite
	}
}
the downside is, its a full blown mirror, no transparency through the water, but still with every effect of the water
to avoid fps issues, i made the one side this shader and all other sides the the stock clear_calm1 shader.
http://q3a.ath.cx/?mapdetails=ghost-accel its a defrag map but u can still run it in baseq3 and look at it.

Re: Combine water and mirror shader

Posted: Sat Mar 06, 2010 10:42 am
by cityy
Thanks, that worked for me!