View Full Version : Water waves in a channel
Fracman
18th October 2003, 11:21
Any water experts around here?
I'm trying to make a channel filled with slowly moving water that has small waves, something like this:
http://www.synthzone.com/~mschreier/df/canal1.jpg http://www.synthzone.com/~mschreier/df/canal2.jpg
top view of the channel:
----------------------------- <- channel border
===> main direction
----------------------------- <- channel border
side view:
------------------------------ <- channel top border
~~~~~~~~~~~~~~~~ <- water wavelets
The water texture is moving fine using tcMod scroll, but it stops scrolling as soon as i add the deformvertex wave, and there are no right waves. The whole water surface simply goes up and down.
Any idea how to produce small waves in a sequence?
damocles
18th October 2003, 12:02
It's something to do with the order in which the shader commands appear in the shader. Try placing one before the other and vice versa to see which works. I had the exact same problem and it drove me nuts for ages.
Also, I think there's a command to "scroll" the vertices too, but I forget what it is called. I think it's possible to make the waves seem to move along the surface instead of going up and down only.
Emon
18th October 2003, 18:21
Post da shadar.
Fracman
19th October 2003, 19:34
Now got some waves working using the deformVertex bulge but it produces strange interruptions.
Anyways it makes the surface count too high and will be very difficult to adjust properly.
thanks for your help.
ydnar
19th October 2003, 20:37
Just post the shader.
y
Fracman
20th October 2003, 05:58
Here is it:
textures/water/005eau_deform
{
qer_editorimage textures/water/005eau
q3map_tesssize 32
surfaceparm water
surfaceparm trans
q3map_material Water
cull disable
deformvertexes bulge 8 2 2
{
map textures/water/005eau
blendFunc GL_DST_COLOR GL_ZERO
tcMod scroll 0.1 0
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_SRC_COLOR
rgbGen identity
}
}
The water channel is made of two adjacent rectangular brushes with the water shader on top and water-nodraw-shader on all the other sides.
I made sure the water texture fits one brush, width=4 height=1, and applied the texture on the next water brush.
The waves appear and move nicely, but there is sometimes a gap in the waves. The gap is not at the brush boundary but somewhere else, and has also triangular form.
http://www.synthzone.com/~mschreier/df/tests/wtest/wtest_01.jpg
If the waves don't work, its not a problem, because they eat up a lot of performance, right? And the map will have lot of water...
I better add some kind of underwater fog now.
damocles
20th October 2003, 10:52
If you want better performance, simply increase the tezzsize of the surface. Adjust to taste.
ydnar
20th October 2003, 15:46
Use 1 brush. If you must break the brushes, the joins must fall on even grid boundaries as your tess size:
Use tessSize 64.
Use -meta in the BSP compile phase. This is important.
y
Fracman
20th October 2003, 20:28
Thanks a lot, that was it (combination of tesssize and grid boundaries).
deformvertexes bulge 8 3 4 works fine now.
I'm also using a floor shader with a base texture that looks like wet rocks with some algues and which is blended with the same texture as the water surface (and moving at the same speed) to produce fake caustics on the ground. They don't really match the waves now, but it looks pretty nice.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.