Shore water shader?
-
- Posts: 47
- Joined: Thu Feb 17, 2005 5:58 pm
I was doing this with implicit vertex alpha/color when we were working on what would eventually be the ocean shader for Battery (in Enemy Territory). It could be done using q3map_alphaMod volume brushes to set explicit vertex alpha and do additional foam/edge passes in shallow water:
http://akiba.shaderlab.com/samples/ocean_2003-01-30/
http://akiba.shaderlab.com/samples/ocean_2003-01-30/
-
- Posts: 47
- Joined: Thu Feb 17, 2005 5:58 pm
The outermost vertexes of the land should all sit on the same plane on the z-axis. That way the water vertexes can match up to them to make the alphamod work.
If you had, say, a strip of beach right around the edge, with a strip of water running alongside it, you could blend the two then put an surf shader overlay over both of them to disguise the blend and use alphamod vol brushes on the seaward wide. I guess the surf shader could be scrolling but with alpha fade and a tcMod to make the surf fade away as it rolls up the beach. It would need a shallow sloped beach though to look natural.
I've been thinking about doing something like this myself, and this was the best thing I could think of. Hope it makes sense.
If you had, say, a strip of beach right around the edge, with a strip of water running alongside it, you could blend the two then put an surf shader overlay over both of them to disguise the blend and use alphamod vol brushes on the seaward wide. I guess the surf shader could be scrolling but with alpha fade and a tcMod to make the surf fade away as it rolls up the beach. It would need a shallow sloped beach though to look natural.
I've been thinking about doing something like this myself, and this was the best thing I could think of. Hope it makes sense.
If you have the Medal of Honor Spearhead DEMO
I needed an effect like this for Subpen level I did for the demo, it included one texture for ocean or water, I used three shaders one for clear, one for the transistion, and then one for opaque using a simple gray scale ramp texture. Open up .pk3 demo files look for the water.shader, please recreate this with your own source, as it is illegal to use this as is.
I pulled out the shader below, Ydnar can speak to these commands working with Q3map2 but I am pretty sure they will, this system gave me pretty good control and might be less overhead during runtime. It gave me the ability to control with brushes where the water was shallow, and where it wasn't.
textures/water/subpen_clear
{
qer_editorimage textures/water/subpen_clear.tga
qer_keyword natural
qer_keyword liquid
qer_keyword subpen
qer_keyword add-on
qer_keyword ocean
surfaceParm water
surfaceparm trans
surfaceParm noimpact
{
map textures/water/noise.tga
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.01 -0.13
nextbundle
map textures/water/noise2.tga
blendfunc add
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.12 0
}
{
map textures/water/subpen_waves.tga
blendfunc blend
alphagen const 0.5
tcMod scroll 0 0.01
}
{
map textures/water/water_shadows.tga
tcMod scroll 0 0.07
nextbundle
map textures/water/water_shadows2.tga
blendfunc filter
tcMod scroll 0.07 -0.07
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
depthFunc equal
}
}
textures/water/subpen_transition
{
qer_editorimage textures/water/subpen_transition.tga
qer_keyword natural
qer_keyword liquid
qer_keyword subpen
qer_keyword add-on
qer_keyword ocean
surfaceParm water
surfaceparm trans
surfaceParm noimpact
{
map textures/water/clear_transition.tga
blendfunc blend
// tcmod scale 0.3 0.3
tcmod transform 0.85 0 0 0.85 0.1 0.1
}
{
map textures/water/noise.tga
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.01 -0.13
nextbundle
map textures/water/noise2.tga
blendfunc add
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.12 0
}
{
map textures/water/subpen_waves.tga
blendfunc blend
alphagen const 0.5
tcMod scroll 0 0.01
}
{
map textures/water/water_shadows.tga
tcMod scroll 0 0.07
// tcmod transform 0.1 0 0 0.1 1 0
nextbundle
map textures/water/water_shadows2.tga
blendfunc filter
tcMod scroll 0.07 -0.07
// tcmod transform 0.1 0 0 0.1 1 0
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
depthFunc equal
}
}
textures/water/subpen_opaque
{
qer_editorimage textures/water/subpen_opaque.tga
qer_keyword natural
qer_keyword liquid
qer_keyword subpen
qer_keyword add-on
qer_keyword ocean
surfaceParm water
surfaceparm trans
surfaceParm noimpact
{
map textures/water/opaque.tga
blendfunc blend
}
{
map textures/water/noise.tga
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.01 -0.13
nextbundle
map textures/water/noise2.tga
blendfunc add
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.12 0
}
{
map textures/water/subpen_waves.tga
blendfunc blend
alphagen const 0.5
tcMod scroll 0 0.01
}
{
map textures/water/water_shadows.tga
tcMod scroll 0 0.07
nextbundle
map textures/water/water_shadows2.tga
blendfunc filter
tcMod scroll 0.07 -0.07
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
depthFunc equal
}
}
The purpose is for a large body of the water btw, not the foam.
I pulled out the shader below, Ydnar can speak to these commands working with Q3map2 but I am pretty sure they will, this system gave me pretty good control and might be less overhead during runtime. It gave me the ability to control with brushes where the water was shallow, and where it wasn't.
textures/water/subpen_clear
{
qer_editorimage textures/water/subpen_clear.tga
qer_keyword natural
qer_keyword liquid
qer_keyword subpen
qer_keyword add-on
qer_keyword ocean
surfaceParm water
surfaceparm trans
surfaceParm noimpact
{
map textures/water/noise.tga
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.01 -0.13
nextbundle
map textures/water/noise2.tga
blendfunc add
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.12 0
}
{
map textures/water/subpen_waves.tga
blendfunc blend
alphagen const 0.5
tcMod scroll 0 0.01
}
{
map textures/water/water_shadows.tga
tcMod scroll 0 0.07
nextbundle
map textures/water/water_shadows2.tga
blendfunc filter
tcMod scroll 0.07 -0.07
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
depthFunc equal
}
}
textures/water/subpen_transition
{
qer_editorimage textures/water/subpen_transition.tga
qer_keyword natural
qer_keyword liquid
qer_keyword subpen
qer_keyword add-on
qer_keyword ocean
surfaceParm water
surfaceparm trans
surfaceParm noimpact
{
map textures/water/clear_transition.tga
blendfunc blend
// tcmod scale 0.3 0.3
tcmod transform 0.85 0 0 0.85 0.1 0.1
}
{
map textures/water/noise.tga
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.01 -0.13
nextbundle
map textures/water/noise2.tga
blendfunc add
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.12 0
}
{
map textures/water/subpen_waves.tga
blendfunc blend
alphagen const 0.5
tcMod scroll 0 0.01
}
{
map textures/water/water_shadows.tga
tcMod scroll 0 0.07
// tcmod transform 0.1 0 0 0.1 1 0
nextbundle
map textures/water/water_shadows2.tga
blendfunc filter
tcMod scroll 0.07 -0.07
// tcmod transform 0.1 0 0 0.1 1 0
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
depthFunc equal
}
}
textures/water/subpen_opaque
{
qer_editorimage textures/water/subpen_opaque.tga
qer_keyword natural
qer_keyword liquid
qer_keyword subpen
qer_keyword add-on
qer_keyword ocean
surfaceParm water
surfaceparm trans
surfaceParm noimpact
{
map textures/water/opaque.tga
blendfunc blend
}
{
map textures/water/noise.tga
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.01 -0.13
nextbundle
map textures/water/noise2.tga
blendfunc add
tcMod transform 1 0 0 1 0 0
tcMod scroll 0.12 0
}
{
map textures/water/subpen_waves.tga
blendfunc blend
alphagen const 0.5
tcMod scroll 0 0.01
}
{
map textures/water/water_shadows.tga
tcMod scroll 0 0.07
nextbundle
map textures/water/water_shadows2.tga
blendfunc filter
tcMod scroll 0.07 -0.07
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
depthFunc equal
}
}
The purpose is for a large body of the water btw, not the foam.
Last edited by Vexar on Sun Mar 13, 2005 1:24 am, edited 1 time in total.
You can still download the old demo from EA site...
Do a search google search for Spearhead Demo
Yes...
With out the textures it's not going to help that much... we also tagged the textures visually so we could see the water direction flow in the editor as they need to be aligned properly so the transision is seamless. Sorry about the 56k, that sucks. I can't post the textures as it would be aganist the law, sorry about that too.