Page 1 of 1

water shader: 'tcGen environment' on huge face

Posted: Mon Oct 06, 2003 11:04 pm
by wacko
Once again a problem regarding a water.shader :roll:
why did i have to start this again :cry:

okay.
i have applied a water texture based on misc_outside/strange_frothy_water to a face of about 10.000x10.000 units. Now the reflections caused by the levels including tcGen environment seem to be completely out of scale: I just get kind of stripes which is neither what they did look like on a smaller face nor is it what I want...
Is there a workaround?

Also, in this shader I have 'reactivated' the line deformvertexes wave 30 sin 0 10 0 .2. As far as I understood the Q3 Shader manual, the parameters are in this case
30 the distance of the wave peaks
sin the wave function
0 the base distance to the face
10 the amplitude, the wave height
0 the phase
.2 the frequency, speed of deformation
With this, the distance of the waves, their 'size' ought to be 30 units, but in fact, the whole face goes up and down...

any ideas where I did so wrong?!

Patch

Posted: Tue Oct 07, 2003 12:20 am
by tltrude
Don't use a patch mesh for the water. Use a normal worldspawn brush and texture all four sides with nodraw. The bottom and top faces have the same water texture and the bottom of the brush should be below the ocean bed--probaby 35 units.

It is hard to texture a patch that big, but it can be done using key P and adjusting the scales.

Posted: Tue Oct 07, 2003 6:05 am
by jv_map
I think your water brush / curve consists of two triangles only, that's why there are no waves (i.e. one triangle can't 'wave'). Therefore you have to force the compiler to split the face up in many triangles, which can be done with the tessSize command in the shader (sets the max size of triangles when using this texture).

For example:
tessSize 64

To get the environment map looking good you may have to use the clampmap command instead of map for this particular stage.

Posted: Tue Oct 07, 2003 9:36 am
by wacko
thanks :D
i'll give it a try!

Posted: Tue Oct 07, 2003 4:42 pm
by wacko
i'm getting closer to what i want :D

it took me quite a time to find out that for a new tessSize, i had to recompile the map: Just changing it in the shader don't do anything...

the environment thing works now, atleast good enough.
but:
the waves still look rather strange:
Image
u probably don'T see much of the waves but u can see the triangles produced by the TessSize 128. What I do not understand is, why they don'T stay on a grid of 128 units. there are wide and narrow triangles and so the waves are nice at some points, invisible at other, cruely edgy at others...
Image
maybe the shader is helpful?

Code: Select all

textures/venice/canalwater
{
	qer_editorimage textures/misc_outside/stream1.tga
	qer_keyword natural
	qer_keyword liquid
	qer_keyword ocean
	qer_trans .4
	surfaceparm nonsolid
	surfaceparm trans
	surfaceparm water
	cull none
	nopicmip
	tessSize 128

	deformvertexes wave 100 in 0 8 0 .2

	{
		map textures/misc_outside/ocean2.tga
		tcGen environment
		tcMod turb 0 .003 0 1
	nextbundle
		map textures/misc_outside/ocean1.tga
		tcGen environment
		tcMod turb 0 .001 .3 1
	}
	{
		map textures/misc_outside/ocean1.tga
		blendFunc GL_ONE GL_ONE
		blendFunc blend
		rgbGen identity
		tcMod scroll .01  -.01
	}
	{
		map $lightmap
		rgbGen Identity
		blendFunc GL_DST_COLOR GL_ZERO
	}
}
and the mentioned Q3S manual says a good value for the distance of the wave peaks in the deformvertex line is 100. In my case i have to choose a distance of 512 or even 1024 to get smooth waves. Do I need a TessSize of 16 to produce nice little waves? And what does this to the FPS?! Probably a killer!!

Posted: Tue Oct 07, 2003 6:09 pm
by jv_map
deformvertexes wave 100 in 0 8 0 .2

should be

deformvertexes wave 100 sin 0 8 0 .2

try this

Posted: Tue Oct 07, 2003 6:27 pm
by tltrude
Here's somthing you can try. For the top layers, use an africain shoreline texture. Normally those textures are applied to a patch and the verticies are move around to get it to look right. But, if the patch is over a deforming ocean brush, the shorline waves get covered and uncovered. If it were part of the ocean texture, that wouldn't happen.

The shoreline texture is awesome!

Image

Posted: Tue Oct 07, 2003 7:20 pm
by wacko
jv_map wrote:deformvertexes wave 100 in 0 8 0 .2
should be
deformvertexes wave 100 sin 0 8 0 .2
of course. sorry, this must have happend during copy/paste into the post!? dunno, but it surely was okay when I did my experiments...

tltrude, yes, the shoreline is awesome indeed, once u make it work like it should :wink:
but how could it help in my case? it's rather for...erm...shorelines, i'd like to have a kind of oily water surface with little waves, no foam... I have no beach but something that shall become kind of venice backstreets: brushfaces in all direction with the waves "coming from everywhere"...