Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Shaders for Idiots

Page: 1 of 1
 Jedi_Vogel
06-30-2004, 11:53 AM
#1
Ok, I've just come back from doing a Google Search and LF search and I've only managed to come up with various versions of the Shader Manual.

Now, it's great and detailled and stuff, but I just don't seem to get it :D

Are there any beginners tutorials to shaders?

Apart from the Shader Manual (which says it's not a tutorial and wasn't intended to be), I found this

http://home.planet.nl/~monstrous/tutshader.html)

But really wanna know how others learned shaders, because when I look at one, it's like another language to me :D

So any ideas or whatever would be great :)
 Codja X
06-30-2004, 3:40 PM
#2
Steal! Pinch! Copy! Plagarise!

Find a shader you like the look of, open it in notepad to se how it's done. Master that one, then move onto another one.

With shaders, there is no quick and easy way. I use ShaderED which is *highly* frowned upon for some reason, but that offers a graphical display of your shader, and if you click the "animate" button, will show the effects you've created with it.

For the new and advanced features that Q3map2 implements you are going to have to get your hands dirty with notepad, so you may as well try and learn it the hard way.
 mslaf
06-30-2004, 4:01 PM
#3
This one should be useful if you don't understand what all these options mean:

http://shaderlab.com/q3map2/shader_manual/)

and this one if you really don't know what to do:

http://www.splashdamage.org/index.php?name=pnPHPbb2&file=viewforum&f=8&sid=e630f3c7326c6f52dd0ed2b4884ad0ca)
 Codja X
06-30-2004, 4:09 PM
#4
Originally posted by mslaf
http://shaderlab.com/q3map2/shader_manual/)

and this one if you really don't know what to do:

http://www.splashdamage.org/index.php?name=pnPHPbb2&file=viewforum&f=8&sid=e630f3c7326c6f52dd0ed2b4884ad0ca)

SNAP! Check out the reply for CG_carl's question - exactly the same links! It's amazing how much information is in these pages, providing you can translate it into plain, understandable English.
 lauser
06-30-2004, 5:15 PM
#5
I think Vogel wants something much more simple than these LINKS or the shader manual.

But like Codja said...clone some shaders to see what they do. Rename them and throw in your own textures, even if they are simple ones. That's what I did to learn shaders. Then later on I started to understand some of the dynamics involved.

ShaderED is really cool BTW.

Also, you will notice that the designers who came up with these shaders used key words to help us understand them.

Words like: scroll, glow, Blendfunc, nomarks,cull....etc.
 wedge2211
06-30-2004, 5:51 PM
#6
I live by finding shaders that do things similar to what I want to do and cannibalizing them.
 lassev
07-01-2004, 3:32 AM
#7
What Wedge said.

Lately I have noticed, be it for good or evil, that it actually is very important you know what each of the commands in your cannibalized shaders do. Sure, to a certain degree you can use them without knowing - I did that for a long time. But my last project taught me a hard lesson of the drawbacks of ignorance. The shaderlab's manual is a very nice tool in trying to understand the shader code (in addition to Leslie Judge).
 Jedi_Vogel
07-01-2004, 3:49 AM
#8
lol, caniballism it is then :D

I'll also try to make sense of the splash damage forum. And I'll take a look at ShaderEd and see where I get with that and the Shader Manual. :)

Thanks again people :)

[edit] Woah...ShaderEd is slightly...um...overwhelming *heads to google for ShaderEd tutorial as it doesn't have help file*
 Codja X
07-01-2004, 8:14 AM
#9
If I remember correctly, the SDK should come with a shader MS word DOC file written by id Software that'll go through the basics with you.

It doesn't have any of the advanced features that have been recently introduced, but as the phrase goes - don't run before you can walk.

Try searching for shader*.doc on your PC
 Jedi_Vogel
07-01-2004, 8:21 AM
#10
I have a document for Scripting, Skinning and EffectsEd but not ShaderEd :/ if you have a ShaderEd document and I PM you my e-mail address, could you send it please? :)
 Codja X
07-01-2004, 8:31 AM
#11
I'm in work at the moment, so I can't send anything your way.

However! I can do the next best thing:

http://www.qeradiant.com/manual/Q3AShader_Manual/index.htm)

This is an online version of that same file. The chances are you've already looked through it, but it's well worth just reading it from the beginning and just using trial and error to learn how to use the various effects.

That is probably the phrase that applies to everybody editing this game: Trial and Error! :)
 Jedi_Vogel
07-01-2004, 8:33 AM
#12
Yeah I have the Shader Manual and have for a while, but it says "This was never meant to be a tutorial" or something along those lines.

For me, it would be like trying to learn to speak Italian with just an Italian dictionary to hand, no teacher and no grammar book. lol

I'd like to figure out how to use ShaderEd, but it's a complicated interface. If Wade sees this he'll tell me to use Notepad, which would be the ideal IF I understood all the rest. :/
 Codja X
07-01-2004, 8:39 AM
#13
ShaderEd does look bewildering to start with, but it really isn't that difficult.

Lets try getting a shader up and running for you. I'll have to use my extremely patchy and unreliable memory for this though.

1st thing: What are you trying to acheive with this shader?

What we'll do is get the basic shader setup.

Open shadered, right click on the yellow folder thing and click "add file", give it a name and then double click on it.

Click on the "stages" tab (ignore any error messages about nolightmap etc).

On the top left you'll have some arrows - you can use these to swap between stages - more on that later.

In the middle on the left, you should have an "add map" or "add texture map" or something like this.

Click on that, find the tga or jpg you want through the browser and voila - a basic shader. Doesn't do anything but it's a base to start from. (please correct me with the proper names of the buttons).

Now, if for example you want some of this shader to be transparent, you should have created an alpha channel for it (i'm am NOT going to go into that). If this is the case, click on the blending options button (or blending browser or whatever it's called), click the background button. You'll be shown a load of different blending options. Click the desired one and there you go.

Your 1st shader!

I know this is crap tutorial, but it's the best I can come up with without looking at the program itself.
 Jedi_Vogel
07-01-2004, 9:09 AM
#14
When I do the first stage, I get "error opening file" :/

it is a JPEG or PNG that I'm trying to open right? :/
 Codja X
07-01-2004, 9:15 AM
#15
JPEG, PNG or TGA - these should all work.

Sorry I forgot - you'll have to click the NEW or Add stage button 1st or all the options will be greyed out.
 Jedi_Vogel
07-01-2004, 9:22 AM
#16
Ok I tried to add

textures/spares/yf_marble2.jpg

And I just get "error loading file" :/

Should I have saved the texture file first?
 Codja X
07-01-2004, 9:33 AM
#17
Does yf_marble2.jpg exist in the textures/spares directory?

Are you doing this in the stages tab?

If not, then save it there. Also, there should be a button next to where you specify the texture map - press this and a normal windows "Open" box should appear. Browse to the file and it should appear okay.
 Jedi_Vogel
07-01-2004, 9:37 AM
#18
I didn't call this thread "Shaders for Idiots" for no reason :D

Yes that file exists in the location I specified

Where's the "stages tab"? lol

I have a "window" on the left with a folder called "Base"
I right click it and select "Add Files"
I double-click "yf_marble2.jpg" in the textures/spares directory

I get the error.

Though if the "stages" tab exists I might be better off... I'm not seeing any "tabs" :/
 Codja X
07-01-2004, 9:40 AM
#19
Ahhhh, I see now.

Right, what you need to do is "add folder" 1st, call it textures/spares.

Then, right click on the textures/spares folder and click "add file"

Double click on the marble file, and you'll see the main shader options pages.
 Jedi_Vogel
07-01-2004, 10:08 AM
#20
Sorry about this... when I right click "Base" I don't get an "add folder" option. I get "Add Files" and "Add Files as Shader Type..." with several sub options. :/

Thank you for your patience.
 Codja X
07-01-2004, 10:22 AM
#21
Bugger.

Okay, try this.

In your shaders folder, create a new text file. Rename it yourmapname.shader, open that in shaderED and try the Add file thing. Once you've give then shader a name (it doesn't have to be the same as the name of the texture) double click on that and see what comes up.
 Jedi_Vogel
07-01-2004, 10:32 AM
#22
Something must seriously be wrong here, because NOTHING what you're saying is working :/

I created yavinfort.shader
I added yavinfort to shaderlist.txt
I then followed your previous instructions and I STILL get the same error :(

Sorry about this Codja :/
 Codja X
07-01-2004, 10:40 AM
#23
No problem. As I said, my memory isn't what it used to be.

Okay, try this. Get an existing JA shader, rename it and open that in ShaderED. Remove all the shaders bar one, rename that shader to one of your preference and double click on that and see what happens.
 CortoCG
07-01-2004, 10:43 AM
#24
I might be of some help. Could you post a download for that precise file? And also tell me what should be the exact path of the file from /base on. Thanks.
 Jedi_Vogel
07-01-2004, 10:50 AM
#25
OK we finally appear to be able edit stuff :D I have something to play with.

Ok, dumb question (though not as dumb as if I hadn't asked), when I apply that texture, is the shader automatically used, i.e. in game will I see the difference, or do I need to do something special to it?

Corto, as it was just an image, there was no need and I've just done what codja says and it looks like I can do stuff...I think :o

[edit] Only the subfolder reads textures/yavin and I can't rename it... should I post a screenie?
 CortoCG
07-01-2004, 10:56 AM
#26
Open the .shader file with notepad and edit the path at will. The only problem is, if the file is not in the new path your enter, then the shader will fail.

The game reads all the .shader files and loads them, checks which effects are applied to which textures. Just follow the naming conventions.
 Codja X
07-01-2004, 10:58 AM
#27
Also, in shaderEd, click on the sourcesafe menu, go to configure and make sure that the paths to your base and shader directories are correct.

As I mentioned earlier - it's all trial and error and for the most part, a pain in the arse.
 Jedi_Vogel
07-01-2004, 11:01 AM
#28
Ok this is what I have now I've manually culled stuff

textures/yavinfort/yf_marble2
{
qer_editorimage textures/spares/yf_marble2
q3map_nolightmap
q3map_onlyvertexlighting
cull twosided
}

Anything abnormal there before I start seriously playing around with it?
 CortoCG
07-01-2004, 11:04 AM
#29
Actually none of us is using Sourcesafe, so no need to care about it, apart from the annoying message that pops up everytime you execute shadered2.
Raven must've use Sourcesafe so developers could check in and check out the shader files and keep it neat and updated, cuz Raven's shaders files are really big.
 Codja X
07-01-2004, 11:04 AM
#30
Originally posted by Jedi_Vogel


textures/yavinfort/yf_marble2
{
qer_editorimage textures/spares/yf_marble2
q3map_nolightmap
q3map_onlyvertexlighting
cull twosided
}



You may want to get rid of the q3map_nolightmap and the q3map_onlyvertexlighting otherwise any brushes covered with this texture won't be lit properly i.e. the game will use vertex lighting on this shader and not the normal lightmap.

I recommended configuring the sourcesafe just to rule out any path based problems. I don't really know how much effect it has or not, but better safe than sorry
 CortoCG
07-01-2004, 11:07 AM
#31
Originally posted by Jedi_Vogel
Ok this is what I have now I've manually culled stuff

textures/yavinfort/yf_marble2
{
qer_editorimage textures/spares/yf_marble2
q3map_nolightmap
q3map_onlyvertexlighting
cull twosided
}

Anything abnormal there before I start seriously playing around with it?

Yeah, something is really wrong. The path for the texture is not the same in both places. One is in /yavinfort and the other (the first shader stage) in /spares. Be extra carefull with that, or it will haunt you, hehe.
 Jedi_Vogel
07-01-2004, 11:08 AM
#32
OK, now I'm set up MAYBE just MAYBE the Shader Manual can make sense and using ShaderEd I can come up with some stuff to help me learn it.

Thank you for your patience, no doubt I'll have questions for you in the near future...

Sometime after my move back to England :/

[edit] And I've updated the path and moved the image to the yavinfort folder ;)
 Codja X
07-01-2004, 11:14 AM
#33
Corto is right - what you should do when creating new assets is to make your shader name, textures directory and map name the same.

Rename then textures/spares directory to textures/yavinfort and make sure you update the shader to reflect this.

The shader should then look like:

textures/yavinfort/yf_marble2
{
qer_editorimage textures/yavinfort/yf_marble2
}


This is your bog standard shader and is a good base to continue from.

[Edit] Got there before me.

Phew, got there in the end. Just have a fiddle around with it now and have a look at other shaders - just generally experiment with them. If you want a nice scrolling shader, you'll have to use tcmod, but find a scrolling shader 1st, open that in shadered and see how it's done.

With practice and patience you'll eventually learn the ropes.
 Jedi_Vogel
07-01-2004, 11:23 AM
#34
Thanks Codja, much appreciated. I'll start future shaders by hand and then see what ShaderEd can do for me, while I learn to do it by hand...

It's still quite scary though lol

Gotta go find a shader which does what I'm looking for (there's a thread around here somewhere) and see HOW it's done but then tone it down.

TchuЯ :)
 lauser
07-01-2004, 3:59 PM
#35
Originally posted by Jedi_Vogel
[edit] Woah...ShaderEd is slightly...um...overwhelming *heads to google for ShaderEd tutorial as it doesn't have help file*

This is exactly why I started a ShaderED tutorial thread here. Because as I stated I did a great deal of searching to no avail. So now when people type in ShaderED2 into Google, this forum will pop up with some answers. Because there are MANY more games that use the same type of shaders we use for JK.

Now as far as specific things that the shader does, only a few will show up in shaderED. For instance the ground shaders and wall shaders will not show animations because they are not animated...:p

I will keep an eye out for that readme though.
 shukrallah
07-01-2004, 9:16 PM
#36
Im just learning to understand shaders, like skys, a little blending, and q3map2_material :) I think i get surfaceparm too...

How do you set up ShaderEd? I try to add a new texture.. but, it wont let me.
 Jedi_Vogel
07-02-2004, 3:57 AM
#37
Try what I did, open an existing shader, save it as something different, delete what you don't want THEN you should be able to add it.

Alternatively, do it by hand :)
Page: 1 of 1