Water waves in a channel


(Fracman) #1

Any water experts around here?
I’m trying to make a channel filled with slowly moving water that has small waves, something like this:

top view of the channel:

----------------------------- <- channel border

===> main direction

----------------------------- <- channel border

side view:

------------------------------ <- channel top border


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) #2

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) #3

Post da shadar.


(Fracman) #4

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) #5

Just post the shader.

y


(Fracman) #6

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.

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) #7

If you want better performance, simply increase the tezzsize of the surface. Adjust to taste.


(ydnar) #8

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) #9

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.