Grates and Global Fog.


(Raven) #1

Has anybody figured out what blend modes to use in your grate shaders so that they will blend correctly with global fog? Here is my shader:


textures/fordtest/floorgrate
{
qer_editorimage textures/fordtest/floorgrate
cull twosided
{
map textures/fordtest/floorgrate
alphaFunc GE128
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
depthWrite
rgbGen identity
}
{
map $lightmap
alphaFunc GE128
blendFunc GL_DST_COLOR GL_SRC_COLOR
}
}

The grate looks relatively ok from above, but if you go to the next lower level and look up it is off-colored and transparent. Thanks ahead of time for any responses.


(fraco) #2

I’m not a shader wizard, rather a shader noob

that being said, when blending with the lightmap, i would have expected
blendFunc GL_DST_COLOR GL_ZERO. Your blendfunc rather would read like

out = lightmap * grate + grate * lightmap

This way your intensity is two times higher

maybe I’m wrong.

and why the depthWrite? Just curious, coz’ I’m not sure of it’s use. I thought if you use it in the first stage, you would rather use depthfunc equal (not sure about syntax) in the second stage. I thought it ‘stamps’ the alpha into the z-buffer. And depthfunc in a manner of speaking then reads it out again to see what parts of the calculated lightmap to actually write in the framebuffer.

i would use
{
map $lightmap
depthfunc equal
blendfunc filter
}

for the second stage

but, as i said, I may be completely wrong

fraco


(pazur) #3

raven. look in the “TGA and fog… (sky fog, not texture)” thread in this forum. urgund posted a shader that works with wolf fog. maybe this could also work on global fog


(Raven) #4

Thanks for the responses guys :slight_smile: I will look into all of your suggestions.


(ydnar) #5

Yes, change the lightmap stage to:

{
map $lightmap
depthFunc equal
blendFunc GL_DST_COLOR GL_ZERO
}

y


(Raven) #6

Thank you much :slight_smile: