I’m having difficulty with blendFuncs and fog, where a window frame that is supposed to be opaque turns transparent only when it is enveloped by fog. I’ll explain…
Here is my texture:
And the alpha channel for the texture (note that the frame is set to be 100% opaque):
Here are the actual shaders, pretty ordinary, nothing special:
// Factory Window
textures/obsidian/window_factory
{
surfaceparm alphashadow
surfaceparm lightfilter
surfaceparm trans
qer_alphaFunc gequal 0.5
{
map textures/obsidian/envmap/iron.tga
tcGen environment
blendFunc add
}
{
map textures/obsidian/window_factory.tga
blendFunc blend
}
{
map $lightmap
blendFunc filter
tcGen lightmap
}
}
// Global fog
textures/obsidian/fog
{
fogparms ( 0.1314 0.1647 0.1873 ) 4096 //R:134 G:168 B:191
surfaceparm fog
surfaceparm nolightmap
surfaceparm nodlight
surfaceparm trans
qer_editorImage textures/obsidian/white.tga
qer_trans 0.5
}
With fog in the map, you can see the gear in the background not just where the glass is, but also through the frame. The frame becomes more transparent the further you are away from it:
Removing the fog, the frame is opaque as I would expect it to be (not a good screenshot, but take my word for it):
Any ideas on how to fix this? I’m sure it has something to do with the blendFunc and setting it to some other explicit blendFunc, but after a bit of trial and error my head hurts.