View Full Version : How do you make grates? (The shader)
03-21-2003, 02:57 AM
That's my question plus some others.
What does cull front and cull back and cull disable do?
How do you make you grate transparent? I mean do you make specific areas transparent or do you use some colour that the engine knows should be transparent?
Also, please explain what some "codes" do in the script. Thanks for you help.
Since Leslie Judge just helped me with this, I'll steer you towards his code to make transparent grates (use the shader code he posted...not mine):
From what I can tell, cull disable makes the grate two-sided. You only need to apply it to one face of a brush (rest of the faces textured with caulk or nodraw) and it will appear no matter which side of it you are on.
To make the grate transparent, you need to have the image saved as a 32-bit targa file with an alpha channel. The alpha channel masks out the areas that you want to be invisible. If you don't know how to do alphas, post back and I'll try to help (if you have photoshop).
I'm pretty clueless about what the specific lines of code do in the shader script. I'm still struggling with grates myself (see aforementioned thread).
03-22-2003, 11:10 PM
How do you do alphas?
It would take a bit too long to explain here because how you create alpha channels varies from program to program (even from version to version). Search these threads and also google for "targa alpha channels" and whatever paint program you are using.
If you use photoshop 7, here's one that explains it pretty well:
Best of luck.
03-25-2003, 05:14 PM
Here's a link to a tutorial on making custom grates
Thanks. I'm going to try out that shader code tonight.
Whoops. I'm an idiot. I had a thread I started on an identical topic and I thought that was a reply...anyway it does help!
03-27-2003, 03:07 AM
From what I can tell, cull disable makes the grate two-sided. You only need to apply it to one face of a brush (rest of the faces textured with caulk or nodraw) and it will appear no matter which side of it you are on
Maybe you meant the same thing, but in case you didn't let me explain my experience in other words: with the cull disable you always draw both sides of your brush visible. So, when you have a grate, normally you just see the side of the grate you are standing on (if it's a floor). With cull disable also the downside of the grate is drawn. Now, it might not sound so bad, it's even realistic, but in reality it's useless and harmful. Not only it reduces FPS, but it also easily makes your grate look like crap. I did it by accident with my first floor grate, and it took me a while to find out, why it looked so lousy.
Cool, I didn't know that. So what's the better alternative for making your grate 2-sided (if you do not use cull disable)?
03-28-2003, 08:13 AM
Aargh! Thanks clu! This was a perfectly earned reprimand for me. I totally failed to think this matter thoroughly. For an ordinary grate, the cull disable is indeed suitable. And now that I think of it, Raven grates must have it, don't they?
With cull disabled you do texture only one side, and the other can be caulked or nodraw, as you said. However, if the cull is not disabled, you must texture both sides of the grate. I would say that if you have cull disabled and you texture both sides, you must carefully align the shaders exactly in the same position on both sides (not sure if even that is enough with a thick brush). Oh yes, this was my problem. Then I let the cull in operation and textured both sides and it was OK (I guess pretty much the same result as with your normal grate).
My grate was actually for a balcony floor, and I just wanted to make sure it had a certain thickness. With only one side textured and cull disabled, I suspect your brush might look like 2D, if you could see it from many angles.
No reprimand intended, lassev. I was actually curious about the cull/2-sided thing because I'm still a bit of a n00b with grates and alpha channels myself (just ask Leslie Judge who walked me through grates in another thread).
BTW, warmaster, that link you posted has the only shader code that has worked for me so far (http://fps.brainerd.net/paintshop5alpha.htm)
Every other code has given me weird results, so thanks much!
vBulletin®, Copyright ©2000-2014, Jelsoft Enterprises Ltd.