awww. thanx my fellow rodent 
fog - sky & water surface blending problem...
hmmmm, ok this water thing is still presenting problems
Without a lightmap stage the water looks ‘OK’ but it could have some dramtic shadowing if only I could figure out the blending for it… the normal ‘filter’ func (in the lightmap stage) goes belly up when used in a map with this blasted skyportal fog shader (infact just about every blend mode does)
The water shader works fine with the ‘lightmap’ info commented out, but uncommented, so far everything I’ve tried to get it to blend and show shadows cast from the surround brushwork haven’t worked. I know I’m missing something but I can’t figure out what… been staring at the file too long… anyone got any more ideas?
current water shader
textures/spkat3/fog_water_beach_y
{
qer_editorImage textures/spkat3/ocean_m1b.tga
// moved this to compile-time for performance reasons
q3map_tcMod scale 0.4 0.2
// q3map_tcMod rotate 180
// deformVertexes wave 160 sin 0 10 0 .3
// surfaceparm nolightmap
surfaceparm nomarks
surfaceparm nonsolid
surfaceparm trans
surfaceparm water
// tessSize 768
waterFogVars ( 0.1 0.1 0.1 ) 2048
{
map $lightmap
rgbGen identity
}
{
map textures/spkat3/ocean_m1b.tga
// blendFunc GL_DST_COLOR GL_ZERO
rgbgen identity
tcMod scroll 0 0.007
depthWrite
}
}
current sky shader
textures/spkat3/sky_forest_day_3200
{
qer_editorimage textures/skies/sky_4.tga
q3map_lightimage textures/skies/n_blue.tga
surfaceparm noimpact
surfaceparm nolightmap
surfaceparm nodlight
q3map_globaltexture
// >> new ratty
q3map_sunext 0.06 0.07 0.10 100 325 35 2 16
q3map_lightmapfilterradius 0 64
q3map_skylight 100 3
// << new ratty
// q3map_lightsubdivide 1024
// q3map_sun 0.06 0.07 0.10 50 325 35
// q3map_surfacelight 200
fogvars ( .1 .1 .1 ) 2048
// skyfogvars ( .1 .1 .1 ) 0.9
skyparms full 200 -
{
map textures/skies/newclouds.tga
// blendfunc blend
tcMod scroll -0.001 -0.003
tcMod scale 6 6
depthWrite
}
}
RTCW GL fog does not properly work with any shader using multiplicative blend modes after stage 2, or any translucent shader with multiplicative blend modes like a lightmap.
This is partially a limitation of GL fog, which fogs the source color fragment as opposed to the destination fragment, and partially a limitation of RTCW: it doesn’t have any alternative fogging code to account for this fact.
You can use a big Q3 fog brush around your level as an alternative.
y
I had to give up on using lightmaps in my wolf alpha mapped “soft edge” water, for I guess the same reasons ydnar`s just mentioned.
but I`ve been planning on testing some fake shadow alpha tex, or high density vertex lit alpha shadows, as a polygon offset type decal projected onto the water surface… is it possible this might help kat?
hah… you know I got halfway down your post and realised what you were going to say… and yes, that may very well be the answer sir ratty… there’s possibly 2 ways to do this… using the _decal entity itself (to ‘project’ a shadow) … or using a ‘decal’ texture (surface effect)… I’ll try the latter as I may have a texure already…!
Good thinking Ratman…! (Batman)
Speaking of water and lightmaps, what’s the best way to get shadows on a semi-trans water?
Currently I’ve got blended water, with a normal multiply lightmap. Fine for single layers, but where you can see through more than 1 plane of water it gets progressively and obviously darker. You can see through more than one plane, for example, when underwater looking at a waterfall.
I’ll probably simply use vertex lighting, but was wondering if anyone had any thoughts?
@kat, your welcome
and please tell us how you get on testing this as it`ll probably save me time testing my end.
@gerbil, I use blendfunc gl_src_alpha gl_one on my water fall, wouldn`t that still show through a blendfunc filter water surface and look bright enough?
Ratty : yep, I forgot to add I’ll let you know how this turns out, if it works I’ll post the textures I used for the ‘shadows’ to save you a bit of time making them yourself.
Gerbil : couldn’t say… I’ve found where fog is involved the blend func don’t work the way it was expected, as ydnar posted above now we know ‘why’
[EDIT] not got it to work yet after a couple of hours trying… even using the ‘entitymergable’ parameter the texture z-fights with the water texture when on the same plane (both in the same place) and for some wierd reason the texture isn’t showing up either, I just get the missing texture checker even though the file paths are correct and the textures in the pk3… very odd
@kat, np and are you using polygonoffset in at the top of your shaders? because that usually prevents z fighting for me… gerbil, taught me that 
have you also got q3map_nonplanar? because I think that`s been causing me problems with some of my alpha mapped blend decals I use to cover up dotproduct seems on my terrain.
so what Ive been doing is raising the decal brushes 1 unit above the other brushes... as their edges are transparent in game, its not noticeable unless I have show tris on.
doing this and using polygonoffset seems to work well.
_decal entities with polygonOffset in the shader are the way to go.
Note if you want to darken an area, use an inverted image and GL_ZERO GL_ONE_MINUS_SRC_COLOR blending. This allows the decal to fog out correctly. See the Enemy Territory shadow and road decal shaders. They won’t z-fight with other marks because they won’t write to the zbuffer.
Add/multiply for brightening (GL_DST_COLOR GL_ONE).
Don’t use depthWrite unless you absolutely have to.
y
Got it to work.
A couple of notes :
1 : it (the decal) doesn’t like being applied to a patch mesh in this particular instance
2 : you can’t have several decal areas overlap otherwise the z-fight with each other. A single decal blends ‘OK’ with the water surface
3 : the brush the decal is applied to has to be cut up (a-la what was originally discussed above and ‘blocksize’) to have divisions below 1024 (or the thickness of the fog) otherwise it doesn’t fog out correctly (using skyportal fog)
[EDIT]just saw ydnars post after posting this one… I’m using ‘normal’ decal textures atm not the _decal ‘entity’
interesting and I can`t find the decal entity in the wolf .def file, is it new? or is it just a func_group with the keyword _decal?
it should be in the right click popup menu at the top as _decal… but I just looked and yeh, it’s not there - I know it’s there for Q3 so maybe it’s another one of those things RtCW hasn’t got support for…!?
I wonder if we can copy/paste the Q3 def file info into the Wolf def file… hmmm
[EDIT] yeh you can copy / paste the info from the Q3 -> RtCW def files, I’m just testing this now…
I know we can edit the .def files, but does this compile and work in game, for wolf? …Ill try testing this myself later on, if you havent posted back here before then.
I just did a quick test… nothing… I might have set it up incorrectly though - from what I understand you have to use a patch mesh with your shader on and this is targeted at an info_null… the patch acts as a ‘lamp’ which projects the texture at the destination point; the info_null (might be the other way around though, I’m not sure). There may be some size limitation though as I got some texture error related to the patch on compiling the test
understood and thanx, good luck with getting something to work, even if us wolf mappers can`t use the decal entity.