Though I'd do a quick test. It involved slightly more faffing than anticipated and became a longish test.
Provided you set up your new textures exactly like I said and don't use the default textures from the game it should work, to an extent. You'll also need to use a patch with two more rows than I showed to get a decent blend, with a 25% or 50% alphamod brush over the middle row of verts, and the 0% brush over the top verts.
I also had to tone down the alpha even more than I expected - I had thought I'd be using the lower 50% of the available tonal range, I went down to the lower 30% before it looked about right. By contrast, remember that the RGB needs to be nice and bright. I just used flat white.
I also discovered that I hadn't edited Q3 on this machine since my last reinstall, so my 1.4.0 project file was pointed to an ancient Q3map2 that had no idea what alphamod volumes were.
It looks OK from a distance but crappy close up. Somewhere in the renderer, it looks like some kind of clip is applied to alpha values that mean that once the alpha drops below a certain point, it gets treated as if it was zero. So a pixel that should have something like 10% alpha or less, gets treated as zero. It might be due to a lack of precision because there's only 8 bits a channel (or is it 7 with overbrights?), it might be something that was put in to fix problems on specific video cards, it might be drivers. Whatever it is, it means that you cannot get a smooth blend to zero. There will always be an identifiable edge, just as if you'd used an alphafunc. It means you can't get a nice fluffy fadeout at the top like you'd want.
Momentarily I suspected that perhaps the alpha channel on my caustics texture wasn't good enough, so to be sure I tested this with a straight 0-1 gradient fill in the alpha channel, and it's definitely the case that somewhere it gets screwed.
I'm probably being overly picky. If you were actually playing the map you'd never notice the edge issue.
Using rgbgen vertex in the shader looks alright too btw. It looks too bright in shadowy corners with rgbgen identity.
This is the shader I ended up with:
Code: Select all
textures/caustics/caustics
{
surfaceparm trans
surfaceparm nolightmap
polygonoffset
{
map textures/caustics/caustics.tga
rgbgen vertex
alphagen vertex
blendfunc blend
tcmod scroll .1 .1
}
{
map textures/caustics/caustics.tga // too lazy to make more than one texture!
rgbgen vertex
alphagen vertex
blendfunc blend
tcmod scale .66 .66
tcmod scroll -.2 .05
}
}
I suppose it might be possible to get around the alpha values being clipped by expliticitly using specific blendfuncs rather than the generic blend, but my shaders are too rusty to want to attempt that
It's a shame there's no such thing as 'alphamod', so you could layer a subtle pulsing waveform on top of the vertex alpha. You can't use an alphagen wave of course, because it cancels out the other alphagen.