Shaders


(mT^Apocalypse) #1

Again, I’m new to the mapping community, and this forums help to my question earlier got my problem solved quickly, thanks again. Anyways, I have a new question. I am a decent amount into the basic layout of the level. Nothing fancy, just a bunch of rooms and such, very few details (did put some work into some rooms and they are turning out suprisingly decent). A friend of mine said that before I go any farther, I should learn how to use shaders. I am a little confused on what they exactly are, and how to use them. Any good links to the best tutorials that would help solve my problem and conquer shaders? I have heard that they are very complicated and will take 10+ hours to learn, but I am ready for it, and am very dedicated to my level. Thanks for your time.

-Apoc :poke:


(LaggingTom) #2

http://shaderlab.com/q3map2/shader_manual/contents.html

All hail!


(mT^Apocalypse) #3

I can’t check it out in detail tonight, because I need some sleep, school night, test tomorrow. But by the looks of it, it looks like the perfect answer, thanks a lot.


(mT^Apocalypse) #4

A quick question: If I am using premade textures, such as the ‘xlabs’ ones, do they have shaders built in?

Should I be fine just working strictly with these xlab textures until i learn more about shaders?


(Ifurita) #5

yes, Look in pak0.pk3/scripts, and you’ll see a file called alpha.shader, misc_metal.shader …

Each one corresponds to, and contains the shaders for the appropriate texture set


(mT^Apocalypse) #6

I see, I see. I’m catching on. Thanks a lot. One last question When rendering, does it automatically call the shaders, or something special I need to do beforehand?


(MadJack) #7

First, in Radiant, if a texture has a tiny white outline it means it is a shader. If there isn’t any white outline, it’s a pure image (jpg/tga).

When ET loads, you’ll see in the console that it parses all the .shader files for reference and will use those that are used in the map (and in the game itself without any map loaded. Like the thundering background you see in the console since that’s a shader).

The way you can look at a shader is as an image though multiple shaders can reference the same image but using different ways to modify it so it displays in a different way.

Does it make sense? :slight_smile:


(The Wanderer) #8

@ mT^Apocalypse let me see if I can explain this a little better.
The game ONLY uses shaders…nothing else. You can use a simple texture without a shader(meaning just a plain image) to texture something, in which case the engine will write an implicit shader for you and use that. So in the end, everything is a shader. In the texture window in radiant you can see both shaders and plain textures. You can distinguish them by noting that shaders have a white outline around their image. For example(since you’re using the xlab shaders) if you open xlab_props in your texture window you can see that xpanel_c10_light is a shader while xradio_c02 is just a plain texture.
Oh and before I forget to answer your question… yes the shaders are called automatically.

Very nice and useful shortcut: If you press Shift + Click on the shader image it will open the shader file containing that shader.

In any case I recommend you write your own shaders for everything, even if they’re just one line (i.e. implicitMap - ) telling the engine which texture to map.
It’s a lot more organized and it makes editing and changing things later a lot easier. For example if you decide you want to change the surface properties of something later on, or you need to map a different texture or you need to move your textures in a different directory…all you have to do is change a few lines in the shader instead of having to replace the textures in radiant.


(Ifurita) #9

Here’s an experiment for you:

  1. Create a new folder for your custom textures called /textures/apocalypse
  2. Go into the /textures/alpha folder and find the texture fence_c10.tga
  3. Copy the texture and paste it into /apocalypse
  4. Rename the texture catwalk.tga
  5. Go into your scripts folder and add a new text file called apocalypse.shader //this is where your custom shaders will go
  6. in /scripts, open up the file called shaderlist.txt. Add the line, ‘apocalypse’ to the bottom (without quotes) //this will ensure the game loads the apocalypse.shader file.
  7. Now, in /scripts, open up the alpha.shader file and find the following:

textures/alpha/fence_c10
{
cull disable
nomipmaps
nopicmip
surfaceparm nomarks
surfaceparm alphashadow
surfaceparm metalsteps
surfaceparm pointlight
surfaceparm trans
implicitMask -
}

  1. Copy and paste this into your apocalypse.shader file making the highlighted edits

textures/apocalypse/catwalk
{
cull disable
nomipmaps
nopicmip
surfaceparm nomarks
surfaceparm clipmissle
surfaceparm alphashadow
surfaceparm metalsteps
surfaceparm pointlight
surfaceparm trans
implicitMask -
}

  1. Now open up Radiant, create a brush that is all common/clipmissile. Texture one side as apocalypse/catwalk. Compile and now you have a section of fence that you can shoot thru but will block grenades, panzers, and other objects. You’ll also be able to walk on it.

(mT^Apocalypse) #10

wow, thanks for those answers Wanderer and MadJack. Also, thanks a lot for the little tut you wrote me Ifruita. I finally think I understand this whole thing, thanks a lot for the help. I havn’t had the time to try your tut yet, since its 12:23 here, and I got school tomorrow. Clan play taking up some of my time. Anways, I’ll definately try that tut tomorrow and mess around with a bit on my own too. I love u guys/gals. :frowning:

-Apoc :poke:


(No1_sonuk) #11

In relation to models, if you skin a part of it with “textures/apocalypse/catwalk.tga” it will automatically use the “textures/apocalypse/catwalk” shader.
The game checks for shaders first by stripping the extension off (".tga" in this example). If it finds a shader, which it will in this example, it’ll use that shader. If it doesn’t, it’ll do the implicitmap thing.


(Ifurita) #12

that partially answers a question of mine. If I have a skin on my model, called models/zeppelin/zeppelin_skin.tga, can I just write the shader to show:

models/zeppelin/zeppelin_skin
{
implicitMap -
surfaceparm slick
surfaceparm woodsteps
}

?


(No1_sonuk) #13

Yup, assuming the syntax of the shader itself is right.


(Ifurita) #14

thx


(No1_sonuk) #15

However, I don’t think the surfaceparms will do any good. Models aren’t clipped by default, and I don’t know if the clipping in the MD3-BSP process takes the shader into account.


(Ifurita) #16

I think i might have added a surfaceparm = clipweapon to the original texture - I was recreating it from memory. Whatever I did, you were able to walk around on the skin.

It’s pretty damn funny to watch people hop onto the skin of the zeppelin (something like 900 units tall), and realize it’s slick – bwhahahahahahahaha


(No1_sonuk) #17

Hmm. I’ll have to experiment with that later.


(Ifurita) #18

I take that back, when I last walked on the skin of my zep, it was patch/brushwork. However, if a model’s skin can take surfaceparm values, there should be no reason why you couldn’t give the skin a *clip quality – one would think


(No1_sonuk) #19

ISTR that RtCW had something like a “solid” spawnflag for the models.