More Shadering. :) (waves in the water)


(Skumtomten) #1

Well, I managed to sort this reflecting water shader out… however now I can’t get it to look like the water’s moving…

surfaceparm nonsolid
surfaceparm water
surfaceparm fog
surfaceparm trans
surfaceparm nolightmap

^^ Above is the parameters I’m using
^^ Below is the other things I’m using


map textures/srefwat/water2.tga
blendFunc blend
rgbGen identity
alphaGen portal
deformVertexes move 90 0 0 //tillagd 1848
tcMod turb .25 0.2 1 0.02 //tillagd 1840

As far as I understand it, it’s the “tcMod” things that controls the “movement” of the texture? :F Though I’ve tried using tcMod scroll, tcMod transform and tcMod scale (Though this only resizes the texture, or am I wrong? :F) and ofcourse as you see above, the tcMod turb… uhm… however my water ain’t moving… can anyone tell me what I’m doing wrong? :blush:
:\ Is it just a small problem somewhere in my shaderfile or have I written totally wrong params and things? :X


(Lanz) #2

If you want to modify the texture coordinates then yes, tcMod is what you want. Observe though that deformVertexes is a general shader keyword and should not be used in a shader stage.

tcMod scroll <s> <t> should do the work.


(Skumtomten) #3

Allright, thank you for helping me… however this didn’t solve the problem. I must still be doing something wrong. :X


	surfaceparm nonsolid
	surfaceparm water
	surfaceparm trans
	surfaceparm nolightmap
		deformVertexes wave 64 sin 0.7 0.7 0 0.7

I moved the deformVertexes to shader-keywords as you told me it should be there. :X
Also I once again added the tcMod “scroll”, so now it looks like this:


map textures/srefwat/water2.tga
blendFunc blend
depthWrite
	rgbGen wave
	tcMod scroll -0.5 0.5

:F This still doesn’t work. Could there be some problem with the texture itself maybe?


(Aborted) #4
map textures/srefwat/water2.tga
blendFunc blend
rgbGen identity
alphaGen const 0.8
tcmod scroll -0.5 0.5

Try that out. If not refer to the Battery shader.


(Lanz) #5

You scrapped the reflective water idea?

Anyway I tested a simple shader with reflection and scrolling texture cordinates that works:


textures/srefwat/portal
{
	qer_editorimage textures/liquids_sd/siwa_water.tga
	qer_tran 0.95

	surfaceparm water
	surfaceparm nomarks
	surfaceparm nonsolid
	surfaceparm nolightmap

//	Bad idea, produces some artifacts together with portals
//	deformVertexes normal .15 2 
//	deformVertexes bulge 128 5 2

	portal

	{
		map textures/liquids_sd/siwa_water.tga
		blendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
		alphaGen portal 1024
		tcmod scroll -0.1 0
		depthWrite
	}
}

If I where you I would keep it as simple as this since portals eat FPS as it is.


(Skumtomten) #6

Hmm…


portal
{
map textures/srefwat/portal.tga
blendfunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
depthWrite
}
{
map textures/srefwat/water2.tga
blendFunc blend
rgbGen identity //alphagen portal screws shit up here
tcMod scroll 0 0.03
depthWrite
}

That’s something how my shader looks like. :stuck_out_tongue: I did not throw away the idea of having reflecting water, just put that aside for awhile, till I got this water moving…
:slight_smile: Anyways, thanks, got it working after you helped me now. :smiley: /hugs Lanz.