Nothing much, but this is a follow-up to a previous post I made in a thread, where someone seemed interested in uses for non-standard blend and alphaFunc settings.
So, I thought I’d post the shader I worked up for alpha-masked textures, that places the lightmap first, and still uses nearly full alpha-blending so the edges almost always look better than ‘harsh’ alphaFunc masking, assuming you have a properly-alpha-channeled texture to begin with.
textures/whatever
{
surfaceparm trans
surfaceparm alphaShadow
{ // Use the mask from the 'grate' texture
map textures/whatever.tga
blendFunc GL_ZERO GL_ONE // Technically optional
alphaFunc GE128
depthWrite
}
{ // Base lighting layer
map $lightmap
blendFunc GL_ONE GL_ZERO // Technically optional
depthFunc equal
}
q3map_styleMarker2
{ // Add the actual 'grate' texture
map textures/whatever.tga
blendFunc filter
depthFunc equal
}
{ // Add the 'faint edges' of the mask texture
detail
map textures/whatever.tga
blendFunc GL_DST_COLOR GL_ONE_MINUS_SRC_ALPHA
alphaFunc LT128
}
}
The first pass just writes out the masking element of the grate texture to the depth buffer, leaving the color buffer untouched.
The second pass adds the alpha-masked lightmap, and has the marker so the alpha-masked lightstyles can be added as well.
The third pass is the actual texture of the grate.
The fourth pass is a ‘trim’ pass, which is why I marked it as ‘detail’ in this case. It evens out the edges of the grate texture, and allows it to continue to be seen even if very sparse at a distance, such as chainlink, instead of simply ‘vanishing’ as plain alpha-masking does. While not ‘technically’ or ‘truly mathematically’ correct, it works quite well none-the-less.
Theoretically, a ‘mathematically correct’ shader could be assembled, but it would involve even more passes, and 4 (7 with 3 lightstyles on it) is already quite a few passes in a single shader for something with no animation or anything else. 
And for those wanting to see what a difference that last stage of the shader makes, along with proof (though subtle) that it works with dynamic lighting:

That image is two screenshots taken from the same place, without moving the viewpoint or anything else, only toggling r_detailtextures to enable/disable that last ‘edging’ pass on the alpha-masked texture.
I didn’t try to perfectly match the colour cycle (it’s a “rotating” white light in a green-lit room shining up at the pillars, a cheap test map I built) but it’s also handy to prove it handles dynamic lighting well.
