Glass texture


(Ramm) #1

Hi,

Another problem: I’m trying to make my own glass, but glass has to be transparent offcourse, so I followed the following manual:

http://www.heppler.com/shader/shader/section5.htm#5

I made this shader (tielt.shader):

textures/tielt/glas1
{
qer_editorimage textures/tielt/glas1.tga
tessSize 64
qer_trans 0.2
}

But now it shows the all know orange-black texture. When I change it to:

textures/tielt/glas1
{
qer_editorimage textures/tielt/glas1.tga
tessSize 64
qer_trans 0.2
{
map textures/tielt/glas.tga
}
}

He shows the correct texture, but it isn’t transparent.

Can anyone tell me what I’m doing wrong?


(CooperHawkes) #2

add

blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbGen identity

after the “map …” line…

your glas.tga must have an alpha channel… otherwise the window won’t be transparent… however, you can also set a constant alpha value if this suits your needs… just additionally add

alphaGen wave square 0.5 0 0 1

(where this is a dirty hack and 0.5 denotes the transparency of the window)


(Ramm) #3

Thanks! That did the trick


(Detoeni) #4

“alphaGen const 0.5”
less of a dirty hack.


(CooperHawkes) #5

const works with alpha? thought this works for rgbgen only… thanks for pointing that out