Game Development Community

Writing Shaders - Tutorials for Artsts?

by Adam deGrandis · in Torque Game Engine Advanced · 11/21/2004 (7:34 pm) · 12 replies

Hey kids. After doing a bit of research a couple of months ago, I fell in love with shaders and what they're capable of. Here's the catch. Im an artist, not a programmer. I can't program AT ALL.

So here is my question, directed to all of you programmers: Is writing shaders as "complex" as writing any other code? What I mean by that is, do you still have to know every bit of math, technical knowledge, etc to write shaders as you do to write any other code for anything? Or are shaders a little more simple to author due to the fact there is just less to write?

Im sorry... I have a feeling this question ranks right up there on the dumb-ometer. I ask because if it isn't impossible for me to learn this in a reasonable amount of time (6 months or so) and become fairly comfortable with it, I want to write a series of tutorials for my fellow artists that explains the process in easy-to-understand language. Shaders are here to stay, and since they deal with the visual side of things, I know a lot of aspiring (and established) artists would want to know how to control them.

So... any thoughts?

About the author

I'm an veteran game artist, teacher, and all around nice guy. Check out my portfolio at adamdegrandis.com.


#1
11/21/2004 (7:57 pm)
TSE will have programable shaders. So you won't have to had a lot or any C++ code.

It uses a HLSL type of interface. What I did was order some books on shaders.
#2
11/22/2004 (4:38 am)
Ok, call me an idiot... What do you mean by programmable shaders? I know there is the procedural stuff. Im quite familiar with how procedural systems work. What Im talking about is custom shaders that wouldnt be able to be produced by the stuff (as vast as it is) being put in place by GarageGames. Wouldn't you have to program those? All my previous research pointed to "yes", which is why I started this thread in the first place.

But besides that, any books you recommend? Im always looking to expand my library.
#3
11/22/2004 (5:47 am)
I might be totally of the hook on what you're wanting to do, but making "custom" shaders inside the engine is realllyyyy easy, even for an artist.

Look in the demo/data/materialMap.cs and demo/server/scripts/shaders.cs. They are really easy to setup with the examples given from the demo.

When you want more complex stuff, just download any of the tools that can read HLSL shader-data, or modify them by hand. I think those are alot more complex to setup, and haven't really tried it yet.

Good luck.
#4
11/22/2004 (5:58 am)
TSE 's procedual shaders are real cool, you tell them what texture to use and what to do to it like glow , emissive, eviromental textureing, bump texture
datablock Material(OrcSkin2)
{
   baseTex[0] = "demo/data/shapes/spaceOrc/orc_ID1_skin";
   bumpTex[0] = "demo/data/shapes/spaceOrc/orc_ID1_skin_bump";
   envTex[0] = "demo/data/shapes/spaceOrc/gun_ID6_slide_bump";
   emmisive[0] = true;
   glow[1] = true;

};

But to do the REAL cool stuff you will need to understand one of the programming languages HLSL, CG or OGLSL and make a custom shader. I have a resource posted about cutom shader, do a search for "shader" in the resource section
#5
11/22/2004 (6:25 am)
Personally I think programming good shaders is more complex than engine code at times. I say this because the shader is going to get run on every single vertex or pixel and thus not only does it need to do what it's supposed to, it also needs to do it *fast* and without much information. It's common to do greusome things like texture lookups for data values etc. that are just complex. That said, I think you (or any artist) can get a handle on it, just expect that you may need someone to optimize it later on if it's really going to be used. There are several great books on the subject; HLSL is probably the easiest place to start.
#6
11/22/2004 (11:22 am)
@ Anthony
I checked out your resource already, and it appears that its exactly the place Id want to start; something rediculously simple (relatively). The only problem is that I don't understand what the code itself means. "float". "struct". What do these things mean? As I said, I am *REALLY* clueless when it comes to code. :) Is this basic stuff that could be learned from any number of generic programming books or is it specific to HLSL?

@ Kyle
Thanks for the info. Any books you care to reccomend?
#7
12/03/2004 (9:52 am)
GPU Gems, the CG Book, K&R for learning C (HLSL, GLSL, and Cg are C-like syntax), I'm sure there are plenty of others, but mostly I just learned shaders by experimentation...
#8
12/03/2004 (10:15 am)
Float and struct are C keywords. . . float3 or float4 are vectors of 3 or 4 floating number and they are shader language specific. You better become more comfortable with coding before plunging into shaders.
#9
12/03/2004 (10:44 am)
Hmmmm.... Good to know. Thanks for the replies, guys.
#10
12/05/2004 (4:42 pm)
Adam; i just found this resource, which i am probably going to check into [being on the art side of things also]:

Shaders for Game Programmers and Artists
by Sebastien St-Laurent

same publisher that did the 3D Game Programming book which uses Torque]. the reader reviews below on the amazon page are also helpful & point to some supporting resources.

- aqaraza
#11
12/05/2004 (8:15 pm)
Heath, thanks a ton. I just checked this out and it seems like it would be a pretty good buy.
#12
12/10/2004 (12:18 pm)
I'm trying to figure out how to do a simple terrain shader that mixes 2 bitmaps with a greyscale mask using up to 3 UV channels.

think thats all I really need as far as shaders go for m to be happy.