View Full Version : Shaders for Dummies and new tech in general
Backov
04-01-2007, 03:06 PM
It seems it's been a LONG time since I did any 3d work, and I've forgotten everything I knew. :) I'm taking the maths again and hope to pick that up pretty quick, but here's the bits I'm missing:
Shaders. The new thing apparently, I have only very little idea how they work. Apparently with XNA (the thing I am toying with to teach myself this new tech) - the only real way to do texturing is with a shader. No simple OpenGL equivalent to just specifying texture coords and going.
Anyway - that said, anyone here actually USING Shaders? And if so, what did you do to learn the tech? I've found a few tutorials online, but they tend to assume you know something about shaders, and thus even the most basic stuff seems to be rather cryptic. That may go away as my maths get better, but it hasn't yet. :)
Sharpfish
04-01-2007, 04:27 PM
While I personally don't use shaders/programmable pipeline in my current games (because of course i'm targetting older hardware with lesser cards) I have messed around with them a bit.
Grab the free download of ATI's rendermonkey to play around with, get used to what you can do with the stuff with a graphical front end
http://ati.amd.com/developer/rendermonkey/index.html
Then read the DX9 + sdk docs on shader coding (HLSL) and if you grasp that then pick up a book like 'Programming Vertex and Pixel Shaders (http://www.amazon.co.uk/Programming-Vertex-Shaders-Charles-Graphics/dp/1584503491/ref=sr_1_1/203-0951167-1420762?ie=UTF8&s=books&qid=1175469947&sr=1-1)' then later something from the 'Shader X' series from the same author. These are not particularly noted as great beginners books I think but they are quite respected.
I'm sure there are better beginner books out there and if so I'd also be keen to know what they are.
HTH
20thCenturyBoy
04-02-2007, 04:35 AM
I second playing with RenderMonkey and the sample projects, which show you most if not all the techniques you will need unless you are Rockstar Games!
A good book is "3D Game Programming for DirectX 9 2nd Ed" by Frank Luna. It foregos the fixed function pipeline entirely and explains shaders and HLSL from the beginning. As long as your C++ is up to scratch it should be ok. Like most "game" books the explanations can be terse. He does have a good web site though and some quite impressive examples.
gmcbay
04-02-2007, 04:47 PM
I third taking a look at RenderMonkey and FXComposer (Nvidia's similar tool) and samples.
In response to a similar question someone asked on the XNA forums a few months back, I wrote a really simple XNA based shading example that you can download here:
http://www.georgemcbay.com/xna/SimpleEffectDemo.zip
It is a bare minimum texturing shader plus associated application code, which is a good starting point to look at and get a sense of how things work without getting lost in more complex calculations like dynamic lighting, etc (most dynamic lighting is actually pretty simple, but still, stripping examples down to the barebones is usually best).
Hint from someone who has been where you are: Don't fear shaders. It takes a little while to "think" in shaders (it helps if you've ever dealt with callback functions, since basically what is going on is the GPU calls into your shader methods as needed to get information on per vertex or per pixel basis), but once you get over that small hump, shaders actually make things that can otherwise be super complicated (like fancy shadowing) a lot easier than they used to be. Make the leap ASAP!
Backov
04-02-2007, 06:07 PM
Thanks for all the responses guys - the Rendermonkey stuff helped a lot, since I could see the simple default texture shader and compare it to the one in examples - they're basically the same.
Overall my XNA tech upgrade learning thingy is going pretty swimmingly. I'm going to do a quick Wipeout knockoff as my XNA portfolio piece - taking the advice of some wise man on this forum. :)
Sharkbait
04-03-2007, 08:27 AM
If I remember correctly, Moonpod use shaders in Mr Robot for stuff like the liquid coolant, hidden room sections and other effects.
MiceHead
04-03-2007, 11:31 AM
We're using shaders in Galaxy Rage (http://galaxyrage.blogspot.com/) (here's a WMV example (http://www.synthscribe.com/galaxy/ripple_shader.wmv) of the wonderful stuff you can do with Pixel Shader model 2.0). My favorite tutorial is the Facewound HLSL Pixel Shader Tutorial (http://www.facewound.com/tutorials/shader1/), and I think the best book I found on HLSL was "Shaders for Game Programmers and Artists."
Backov
04-03-2007, 11:37 AM
We're using shaders in Galaxy Rage (http://galaxyrage.blogspot.com/) (here's a WMV example (http://www.synthscribe.com/galaxy/ripple_shader.wmv) of the wonderful stuff you can do with Pixel Shader model 2.0). My favorite tutorial is the Facewound HLSL Pixel Shader Tutorial (http://www.facewound.com/tutorials/shader1/), and I think the best book I found on HLSL was "Shaders for Game Programmers and Artists."
That is a pretty cool tutorial - for those with link phobia, it's about using shaders to apply effects to a purely 2d, sprite driven game, but rendered with a PS2.0 shader capable engine. Pretty cool.
Sybixsus
04-03-2007, 12:52 PM
I also found "Shaders for Game Programmers and Artists" to be a very readable and useful book. It assumes no prior knowledge, no stunning grasp of math, and gives you a decent overall view. It doesn't give you the stunning next-gen effects, so you will want one ( or more ) of the ShaderX series if you want that stuff, but for a good introduction, I think it's ideal.
It's just a shame it leans toward RenderMonkey, which is a lot less useful IMO than FXComposer, since FX Composer is much better with ATI cards than RenderMonkey is with Nvidia ones.
Backov
04-16-2007, 08:00 PM
I got that book (Shaders for Game Programmers and Artists) - and I second the recommendation - it's quite good for learning shaders.
Applewood
04-17-2007, 04:56 PM
Any of the racor shaderX books/online tuts aren't bad. The earlier ones cover the basics nicely.
I learned most of it from the help files tbh - they're really not that bad. You'll be amazed how simple it all is tbh. I'd say it's way easier for a newb to learn shaders than all that nightmare FFP shite, so definitely stick with it.
They're also not new. Years old in fact. You'd be amazed what you can target if you stick within the confines of model 2.
EDIT:
I would reccomend skimming over/ignoring completely all the .FX crap you'll read about. It's a middleware thingy that's buggy, hard to master and imo totally pointless. I liken it to retained mode in the DX3 era - a solution looking for a problem. Trust me, even if you do decide to use it later, ignore to begin with and focuse on what you need to learn - HLSL. Adding FX from the start/at all just steepens the curve
vBulletin v3.6.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.