Jump to content

Home

How do you make grates? (The shader)


yangyan

Recommended Posts

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.

Link to comment
Share on other sites

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):

 

http://www.lucasforums.com/showthread.php?s=&threadid=95185

 

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).

 

-clu

Link to comment
Share on other sites

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:

 

http://www.lowrestv.com/lowres/tutorials/tutorial_01.asp?tut_id=t6

 

Best of luck.

 

-clu

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

 

-clu

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...