Best place to start shader programming

Started by
6 comments, last by allingm 12 years, 4 months ago
Advertisement
Gorbstein
Author
120
April 25, 2011 05:24 PM
I've only ever programmed the fixed function pipeline and want to start playing with shaders. Where, in terms of sites, books, tools and language, is a good place to start?

Assume I have good knowledge of 3d programming but no knowledge of shader technology at all, how it works, etc. What are the things I should know? What are the main shader languages and what are the differences? Do I have to write different shaders for OpenGL and DirectX?

I'd also be interested to know what level of shader programming is currently 'compatible' with most of the PC hardware base just now.

Thanks,

D
AverageJoeSSU
April 25, 2011 05:33 PM
You can start in any or all of the following,
The Cg Tutorial by nvidia,
The Orange Book (GLSL), (get the latest addition)
The DirectX SDK (HLSL)

Shader model 3 (dx9) is the most common shader model you will find in hardware today.
If i recall the orange book is great for those leaving the fixed function world and entering the programmable pipeline world

------------------------------

redwoodpixel.com

Gorbstein
Author
120
April 25, 2011 07:00 PM
Thanks!

Taking a trip to amazon. The cg tutorial also looks very good.

D
matt3d
April 26, 2011 02:10 AM
ShaderX2 books are freely available and cover SM 3.0, as averagejoe said, SM 3.0 is kind of the standard, yes there is shader model 5.0 these days but a ton is still done in 3.0.

http://tog.acm.org/resources/shaderx/

You can skip ShaderX first book as it is about programming shaders in assembly.
EricRRichards
April 26, 2011 02:27 AM
One of the easier to follow OpenGL tutorials (which uses shaders heavily, only 2.0, I believe, though) is here: http://duriansoftware.com/joe/index.html
allingm
April 26, 2011 03:30 AM
I've only ever programmed the fixed function pipeline and want to start playing with shaders. Where, in terms of sites, books, tools and language, is a good place to start?[/quote]

I started my learning with DirectX. You can find the best tutorial for shaders in the following books:
http://www.amazon.co...03786385&sr=8-2 (DirectX 9)
http://www.amazon.co...03786385&sr=8-1 (DirectX 10)

You can also find a tutorial on the game dev book:
http://wiki.gamedev....Book:Book_Cover

Assume I have good knowledge of 3d programming but no knowledge of shader technology at all, how it works, etc. What are the things I should know? [/quote]

If you want a run down of the pipeline you can probably find it in the books above, but you can also find it in this awesome book:
http://www.amazon.co...03786596&sr=1-1

What are the main shader languages and what are the differences?[/quote]

There are mainly 2 "shader languages", HLSL and GLSL. HLSL works with DirectX and GLSL with OpenGL. The differences between these are actually quite minimal. The place where they really differ is the different versions within those. I'm most familiar with HLSL, so I'll break it down for you. You can find the different version numbers (for some reason 5.0 isn't included) here: http://en.wikipedia....Shader_Language While the page lists the hardware differences the main things you need to know are:

v 3.0 - DirectX 9
Pixel and vertex shaders
v 4.0 - DirectX 10
Adds the geometry shader
v 5.0 - DirectX 11
Adds the compute shader and hull shaders for tessellation

Do I have to write different shaders for OpenGL and DirectX?[/quote]
Yes, but the code is very similar.

I'd also be interested to know what level of shader programming is currently 'compatible' with most of the PC hardware base just now.[/quote]

I would say if you're shooting for the greatest level of compatibility I would shoot for DirectX 9. If you want the most shaders you can learn I would go with DirectX 11 (requires Windows Vista or 7). I would say use DirectX 11 for making graphics demos and learning, and DirectX 9 for making a game other people can play.
Gorbstein
Author
120
April 26, 2011 07:54 AM
Brilliant responses so far, thanks. Already having fun getting my teeth into this.

D
allingm
April 27, 2011 07:53 AM
One more of a similar post:

http://www.confettispecialfx.com/you-want-to-become-a-graphics-programmer

This topic is closed to new replies.

Advertisement