Good *books* on shaders?

What books do you suggest regarding shaders, as in learning them better, HLSL knowledge, etc?

I started working with shaders in UnrealEd/Unreal Engine 3 when Roboblitz was released around 2006, but want to spend more time learning what’s going on under the hood.

Best way I found to learn about shaders is to grab something like FX composer and start dissecting their shaders, and to try to write your own.

There’s a couple of renderman books out there that apply to HLSL, GPU Gems is a good series but a lot of it isnt applicable to the general games (yet).

Try writing a shader from scratch, starting by a solid color, then moving up to a lambert, then to a phong, then reflections, and learn how to do texture operations and you’re pretty much better off than a lot of people =)

Then you can go into the trickier stuff like cheap anisotropic highlights, faking refractions, full screen shaders, using multiple uv sets and vertex colors.

Not books, but how about Ben Cloward’s HLSL Shader Creation DVDs?

Link

The first one pretty much goes over the stuff lkruel mentioned. Haven’t bought the second one yet. (Not much point when I’m working on DS ATM).

this book is pretty decent

http://www.amazon.co.uk/Shaders-Programmers-Artists-Development-Paperback/dp/1592000924/ref=sr_1_1?ie=UTF8&s=books&qid=1221059033&sr=1-1

it’s a little bit old and uses rendermonkey not fx-composer, but it’s about the only book i’ve found which presents hlsl shaders in an artist friendly way. the gpu gems books seem more geared towards hard core graphics programmers to me :):

I forgot to mention that Ben’s DVDs are aimed at the artist rather than the programmer so they should be easier to get into.

[QUOTE=thedood;1259]
http://www.amazon.co.uk/Shaders-Programmers-Artists-Development-Paperback/dp/1592000924/ref=sr_1_1?ie=UTF8&s=books&qid=1221059033&sr=1-1[/QUOTE]

I didn’t really like this book that much. . .actually what i said to one of my friends was “i feel like i know less about shaders after reading this book than i did when i started.”:D: I just felt like it was TOO rendermonkey oriented and didn’t really teach any of the points of coding shaders, which i definitely think is key. Maybe not for an artist, but for a tech artist definitely. It could be that i was a little further along than the book was when i picked it up, i actually only bought it because i was looking for a reference on render targets and at the time it was the only book i could find that had anything even remotely related to them.

This book is SUPER dated, but it’s free and a pretty good simple starting point:

The Cg Tutorial

Some of you may remember this from years ago. . .

I second Seth’s recommendation. I learned to write shaders starting with The Cg Tutorial. And of course if you learn more easily from seeing principles demonstrated than from reading about them in a book, my DVD series fills that need. I tried to create the DVDs to cater to the point of view of an artist who hasn’t done any coding before. A lot of the books out there on the topic of shaders assume you already know C or some other programming language.

1 Like

I would start by searching around on the net for tutorials, then maybe look at the shaderx books. The first two are open source, but I dont know what is availible yet.

Also of course Bens DVDs!

A nice simple start for pixel shaders is here http://www.facewound.com/tutorials/shader1/

Also Mediaplayer classic allows you to process video through a pixel shader.
There are plenty of example shaders and its nice to mess with. Or Fxcomposer, even 3ds Max or Maya. You can edit code and see the results instantly.

I think you might get most out of just messing with pixel shaders first.

I got the most out of editing other peoples shaders… and dont forget to end your lines with a ;

Apparently I have not been doing a good job promoting the Wiki.

[w]Portal:Shaders[/w]
[w]Category:Shaders[/w]
[w]Category:Rendering[/w]

Learning shaders is a lot less painful now than it was even a couple years ago. I’d avoid the books- as has been stated, they are targetted for programmers and with the other resources available, are just not worth it. Most of my suggestions are already put on the Shaders Portal page linked to. Ben’s DVD is great- people sometimes don’t want to put the time or money into a DVD, but they are easily the best bang for your buck, much better than Google or a book, second only to a friend you can bug for lessons.

If you are a 3ds max user, I’d also suggest [w]ShaderFX[/w]. If you have no Shader knowledge, it will help you get acquainted with the ‘logic’ of creating a shader in a very intuitive interface. If you have good shader knowledge, Kees and Ben often implement really cool techniques and methods that you can then steal from their code and see how they work (it is also useful for figuring out all the issues with FX files in Max).

Surprises me there are not more Shader creation tools like the ShaderFX tool on the market seems to have taken time for these type of tools to emerge… resource for learning seems scarce as well.
I know of mental Mill and I guess, Maxwell…

I’ve recently been using our in house tools for realtime shader creation in this way, its been awhile and getting into it has been fun. Much better than dealing with the code side of it although I do wonder how much more efficent it could be if the shader was then taken and rewritten by a programmer.

[QUOTE=rhexter;1467]Surprises me there are not more Shader creation tools like the ShaderFX tool on the market seems to have taken time for these type of tools to emerge… resource for learning seems scarce as well.
I know of mental Mill and I guess, Maxwell…

I’ve recently been using our in house tools for realtime shader creation in this way, its been awhile and getting into it has been fun. Much better than dealing with the code side of it although I do wonder how much more efficent it could be if the shader was then taken and rewritten by a programmer.[/QUOTE]

Although it takes effort to write an editor I think it makes a lot of sense to do this in house, often you need to build it around features of the engine lighting etc. and the material system it uses.

That is not to say you cant take an existing tool and intergrate it.

As for the code they produce, it is normally HLSL and can include some hand written blocks of code. The quality of the code is depedent on the user of the editor and the person who wrote the editor. I think it’s quite hard to mess this up, HLSL is not too complicated. No mater what you write in HLSL, you are at the mercy of the complier (which is different depending on platform) that produces the actual code that runs on the GPU.

I would recommend learning HLSL, then you can understand the shaders your editor outputs and how shaders work in general. It helps you become more creative with what you can do with them too. Reading the shaders you output is a good starting point.

You probably wouldnt see much or any improvement with a programmer writing HLSL, you might see a tiny difference if they wrote a shader in ASM. It might also go the other way and it become worse. The gains a losses are probably tiny, its not worth considering.

It is worth grabbing this:
http://www.paradoxalpress.com/LayoutSamples/HLSLReference.pdf

As it gives you a rough idea of how much each HLSL function costs, by the amount of instructions it uses. So then at least if you spot a function like “smoothstep” etc. you know its expensive.

edit:

Since writing this I read this post by Wolfgang Engel
http://diaryofagraphicsprogrammer.blogspot.com/2008/09/shader-workflow-why-shader-generators.html

Which has some argument on the subject, but like some of the comments, I don’t totally agree with what he is saying.
But maybe I will investigate more the performance of the shaders produced by editors

edit:

And another, with many comments

http://realtimecollisiondetection.net/blog/?p=73

Speaking of Wolfgang Engel, I have found his “Programming Vertex and Pixel Shaders” to be invaluable. There is an updated edition, “Programming Vertex, Geometry, and Pixel Shaders” but it is already out of print and impossible to find :frowning:

I guess Ben is to modest to post the link? :nod:

https://www.cg-academy.net/es_catalog/product_info.php?products_id=64

Hello everyone. I’m a kind of technical artist who is located between programmers and artists. I’m interested in realtime-shader. When I attended GDC2008, I realized the importance of TA. After that, I’m looking for the effective way to learn shader with artists who are into shaders.

During the trial and error, I think that it’s difficult for artists to communicate with programmer smoothly when developping new type of shader. Because artists usually aren’t familiar with shader-code, they can’t communicate to programmer what they want to express. As a result, what artists can show programmer is only materials such as photograph, pre-render-image, drawing etc.

However, I believe there are more effective method in the world. As mikiex mentioned in this form, I think that Graph Based Shader System (GBSS) is an interesting approach . So I tested mental-mill artist edition for developing prototype shader. Unfortunately, mental-mill isn’t perfect tool yet.

http://developer.nvidia.com/object/nvision08-mentalmill.html

Additionaly, I was surprised to see the shader-system which is based on Maya’s hyper-shade developed by ‘Tri-Ace’ at CEDEC2008 in Japan.
http://research.tri-ace.com/

‘Tri-Ace’ will give a related presentation at GDC2009.
https://www.cmpevents.com/GD09/a.asp?option=C&V=11&SessID=8954

I’m actually trying to conduct a study-meeting about ‘shader for artist’ in my team. I’m going to use ‘shaders for programmers and artist’ as the educational material. Because this book is most adequate material for artists to study shaders so far.

I’m sorry for my long preface. But I would like to know your challenges or useful materials to study shaders for artists. (For example, mental-mill approach , to hold a study session by using “Shaders for Programmers and Artists” …)

Could you please give me some feedback on my comment?

Dragonboy its good to hear from Japanese developers, we dont get as much information from Japan as we would like, but there are some great insights from translated webpages and documents on Lost Planet / MGS4 / SOTC.

Also Masaki Kawase has done some well know work with PS2 and Dx9.

As mentioned some people are not happy with GBSS, but I also belive these people have not used a system very focused for the game engine. Another issue maybe that programmers don’t trust artists to be careful with performance!!

I have not used Unreal Engine 3, but from looking at screenshots this looks similar to what I would expect from a GBSS.

http://www.hourences.com/book/tutorialsue3mated.htm

http://www.hourences.com/book/tutorialsue3mated3.htm

mikiex, thank you for your feedback! (and I’m sorry for the late response).

Generally, Japanese developers aren’t fluent in English.
But we understand that English is very important language to share useful information.
So it’s informative to exchange the information via TA.org in English.

As many developers discussed, I also think that GBSS has positives and negatives.

-positives
・Artist Friendly -> the capability to create innovative shader by artist’s feelings
・Improvement working efficiency -> Improvement shader quality

-negatives
・the source code which GBSS generates is hard to read and optimize for programmer.
・it’s difficult to estimate the cost benefit. (so I can’t persuade my boss the effectiveness yet.)

Anyway, it’s a bad idea that every artist should touch GBSS.
I think that the person who should use GBSS is only a few shader-writer or TA.

Sorry for straying from the main point. I think that we should talk about GBSS on another thread.
So I’ll post a new thread about GBSS!

Thanks.

[QUOTE=rgoer;2063]Speaking of Wolfgang Engel, I have found his “Programming Vertex and Pixel Shaders” to be invaluable. There is an updated edition, “Programming Vertex, Geometry, and Pixel Shaders” but it is already out of print and impossible to find :([/QUOTE]

the book can be found online

http://wiki.gamedev.net/index.php/D3DBook:Book_Cover

someone also put the content into a pdf (some images missing)
http://www.megaupload.com/?d=FRS1PLCZ

This book goes into great detail on the rationale for the approach and the step by step activities required to move through the process. It is a well set-out and thorough guide for practitioners.

Term papers writing service