Page 1 of 1
Shader for metal with reflection?
Posted: Fri Sep 12, 2003 7:34 pm
by wacko
Hi!
with a shader like
Code: Select all
textures/glass/glass
{
qer_editorimage textures/glass/glass_rad.tga
qer_keyword window
qer_keyword glass
qer_trans .5
surfaceparm glass
{
map textures/mohcommon/envnormndy_day.tga
tcgen environment
alphagen const .2
blendFunc blend
}
{
map textures/glass/glass.tga
depthWrite
alphaFunc GE128
alphagen const .2
nextbundle
map $lightmap
}
}
i get a plain glass texture with the well know environment reflection.
So far so good!
But now, I want to have a metal texture (or atleast something NOT transparent) with that reflection and can't get it working.
Any ideas?
Posted: Fri Sep 12, 2003 10:54 pm
by panTera
Hi Wacko, just take a look at this door texture, this is the effect you want => general_structure/interior_door1
[this is the shader]:
textures/general_structure/interior_door1
{
qer_keyword wood
qer_keyword door
surfaceparm wood
{
map textures/special/copperenv1.tga
tcGen environment
}
{
map textures/general_structure/interior_door1.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
}
The white parts of the alpha won't be affected, and black parts won't show. So you have to make an alpha channel with white and gray parts (the parts you want to make shiney) or a whole gray layer. I'd suggest at least 25% opacity, or even better make a gray layer and use a little "add noise" effect. But just take a look at that door texture and its alpha and you'll know what to do.

Posted: Fri Sep 12, 2003 11:02 pm
by wacko
hey, PanTera
Thanks!!

I was checking the forum every 5 minutes for a solution...
will give it a try immediately!
Posted: Fri Sep 12, 2003 11:20 pm
by wacko
WAHOOOO
it works!! you might say: "of course, why not?!" but this is probably the most beautiful and important texture ever (well, for me...)
thank you very much again!

mud
Posted: Sat Sep 13, 2003 12:54 am
by tltrude
The mud puddle texture works great as a reflection layer.
Posted: Sat Sep 13, 2003 2:07 pm
by panTera
Alrrright! You're welcome.
Oh yes, that's right tltrude, forgot to mention that. You can of course use any texture as the reflection layer.
Posted: Mon Dec 22, 2003 3:44 am
by diego
I'm not having any luck getting this trick to work. I've looked at the .tga files for those door textures. There isn't really an Alpha channel on them. The metal parts of the door are just more transparent than the rest in the color channel. If I understand it correctly, that shader will overlay the envmap on top of the alpha parts.
I want a reflective titanium wall so I need the environment map all over. I've tried using a grey alpha channel with no effect. I also tried cutting out sections in the color channel just like in the door texture. That doesn't work either. So I'm really not sure what I am doing wrong.
This is what I have for my shader:
textures/bktown/w_steel.tga
{
qer_keyword pipe
qer_keyword special
qer_keyword metal
qer_keyword rusted
surfaceParm metal
{
map textures/special/silverenv.tga
tcGen environment
}
{
map textures/bktown/w_steel.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
map $lightmap
rgbGen identity
blendFunc GL_DST_COLOR GL_ZERO
}
}
Posted: Mon Dec 22, 2003 8:31 am
by wacko
Go to
the mohaa trashbin and download the whole UFO to study its textures. Maybe u just didn't save the tga as 32-bit? What image editor are u working with?
As far as I remember u will have to make the complete layer with the texture almost totally transparent and that's the shader:
Code: Select all
textures/ufo/glanz2
{
qer_editorimage textures/ufo/glanz2.tga
surfaceparm metal
{
map textures/mohcommon/envnormndy_day.tga
tcGen environment
}
{
map textures/ufo/glanz2.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
}
Posted: Tue Dec 23, 2003 1:00 am
by diego
I'm using photoshop 7. The .tga was 32 bit, but maybe I didn't make the alpha transparent enough. I don't really see any significant difference between your shader and mine. But I'll go check out the trashbin when I get off work.
Posted: Tue Dec 23, 2003 4:48 am
by diego
I downloaded your ufo map. I've copied your shader exactly. And I've double checked my .tga file. Your images did not have a separate Alpha Channel either. It was built into the color information. My texture works the same way. My Opacity is at 30%. Is that still too high? Because I'm not seeing anything yet.
I also tried applying this to a texture that I need to have a completely transparent border. The area of the .tga file that is 100% transparent, simply shows up as white in MOH.
Posted: Tue Dec 23, 2003 9:58 am
by wacko
with the ufo-lager.pk3, u got textures/ufo/glanz2, glanz3, glanz_double.
A grey, a green and one with cull=none for patchmeshes.
Do they work? Just for testing, did u put in ur map e.g. 3 brushes each with one of those textures?
if u did and they worked, then ur shader or texture must be somehow different (obviously). if they didn't work either, the problem is something else...
unfortunately, i'm off over xmas and won't be back before 25th, but if u still can't get it working by then, send me ur tga and i'll make it work!
in ps7, ur image should have no background-layer, 30% opacitiy is fine. when u save this as a 32bit Targa, it ought to work...
Posted: Wed Dec 24, 2003 7:05 am
by diego
Sorry, I didn't think to actually try your textures in my map. I was just checking out the shader and the images in Photoshop to see if I was making them correctly. I'm off for xmas as well until Jan 1. I'll try your textures when I get back. Thanks for the help.
Posted: Fri Jan 09, 2004 7:54 pm
by diego
Finally got this fixed. My texture was fine. I had extra qer editor image lines in my shader. I assumed that these were to help you query radient to display all textures that were wall, or metal, or whatever. I guess I was wrong. In any case, I made my shader identical to yours and the reflection map is working and so is the metal sparks and bullet holes that I wanted. Thanks for the help.