Wolfgang F. Engel

Mentioned 2

Welcome to ShaderX6, the latest volume in the cutting-edge, indispensable series for game and graphics programmers. This all-new volume is packed with a collection of insightful techniques, innovative approaches to common problems, and practical tools and tricks that provide you with a complete shader programming toolbox. Every article was developed from the research and experiences of industry pros and edited by shader experts, resulting in unbiased coverage of all hardware and developer tools. ShaderX6: Advanced Rendering Techniques provides coverage of the vertex and pixel shader methods used in high-end graphics and game development. These state-of-the-art, ready-to-use solutions will help you meet your everyday programming challenges and bring your graphics to a new level of realism. This collection offers time-saving solutions to help you become more effi cient and productive, and is a must-have reference for all shader programmers.

More on

Mentioned in questions and answers.

I'm a beginner with OpenGL ES 2.0 and I'm looking for a good book/resource that will help me with my learning. I've found several books:

  • OpenGLĀ® ES 2.0 Programming Guide
  • iPhone 3D Programming: Developing Graphical Applications with OpenGL ES

but reading the Amazon reviews I saw that they either assume previous knowledge with OpenGL or are not written specifically for iOS. (I know OpenGL should be easy to port, but I'm looking for a book/resource with examples in C, not C++, that talks about OpenGL in the iOS context)

I also found this and it really helped me getting a grasp on the basic concepts, but unfortunately, they cover OpenGL ES 1.1 and are only describing the basics.

Any help would be appreciated!

It's a lot easier to find OpenGL ES 2.0 material for iOS (or any OS, really) than it used to be a year or so ago.

For something written from a pure iOS perspective, it's hard to beat Jeff LaMarche's chapters from his unpublished book, which start here. You linked to his OpenGL ES 1.1 tutorials, which are also great, but he didn't place his newer 2.0 material on that list.

iPhone 3D Programming by Philip Rideout is a great book that covers both OpenGL ES 1.1 and 2.0. It does not assume that you know OpenGL ES, and he does explain a good bit of the math and other fundamentals required to understand what he's talking about. He gets into some pretty advanced techniques towards the end. However, all of his code is in C++, rather than Objective-C, so that may be a little disconcerting for someone used to Cocoa development. Still, the core C API for OpenGL ES is the same, so it's easy to see what's going on.

If you're looking for particular effects, the OpenGL Shading Language book is still one of the primary resources you can refer to. While written for desktop OpenGL, most of the shading language and shaders presented there translate directly across to OpenGL ES 2.0, with only a little modification required.

The books ShaderX6, ShaderX7, GPU Pro, and GPU Pro 2 also have sections devoted to OpenGL ES 2.0, which provide some rendering and tuning hints that you won't find elsewhere. Those are more advanced (and expensive) books, though.

If you're just getting started with OpenGL ES 2.0, it might not be a bad idea to start using GLKit (available only on iOS 5.0), which simplifies some of the normal setup chores around your render buffers and simple shader-based effects. Apple's WWDC 2011 videos have some good material on this, but their 2009 and 2010 videos (if you can find them) provide a lot more introductory material around OpenGL ES 2.0.

Finally, as Andy mentions, I taught a class on the subject as part of my course on iTunes U, which you can download for free here. The course notes for that class can be found here or downloaded as a VoodooPad file here. I warn you that I go a little technical quite fast in the OpenGL ES 2.0 session, so you may want to watch the 1.1 session from the previous semester here. I also talk a little bit about what I've done with OpenGL ES 2.0 in this article about my open source application (whose source code can be grabbed from here, if you'd like to play with a functional OpenGL ES 2.0 iOS application).

I want to get started doing some game development using Microsoft's XNA. Part of that is Shader development, but I have no idea how to get started. I know that nVidia's FX Composer is a great tool to develop shaders, but I did not find much useful and updated content on how to actually get started.

What tutorials would you recommend?

SAMS's XNA Unleashed by Chad Carter is a great starting point for XNA and assumes little knowledge of game development practices or hard maths before you start. It has two chapters on basic and advanced shaders.

As a sidenote, keep an eye out on Google for WPF Shader tutorials, it now uses the same technology to allow customer shaders in WPF applications and tutorials for that I believe are largely compatible with XNA.

Development of shaders in XNA (which obviously uses DirectX) requires knowledge of HLSL or shader assembly. I'd recommend getting familiar with the former before diving into the latter.

Before writing any shaders, it's a good idea to get solid understanding of the shader pipeline, and attempt to get your mind around what is possible when using programmable shaders. When you're familiar with the life of a pixel (from source data all the way through to the screen) then understanding examples of shaders becomes a lot easier.

Next make an attempt to write your own HLSL which does what the Fixed T&L pipeline used to do, just to get you hands dirty. This is the equivalent of a "hello world" program in vertex/pixel shader world. When you're able to do that and you understand what you've written you're ready to go onto the more fun stuff.

As a next step you might want to simulate basic sepcular lighting in one of your shaders from a single light source. You can then adapt this down the track to use multiple lights. Play with colours, and movement of lights. This will help get familiar with the use of shader constants as well.

When you have a couple of basic shaders together, you should attempt to make it so that your game/engine uses multiple/different shaders on different objects. Start adding some other bits like basic bump or normal maps.

When you get to this stage, the world is your oyster. You can start diving into some funky effectcs, and even consider using the GPU for more than it was originally intended.

For those who are a little more advanced, there are a couple of good books that are available for free online which have some great information from Nvidia here and here.

Don't forget that there's an excellent series of books called ShaderX which covers some awesome shader stuff. There's 1, 2, 3, 4, 5 and 6 already in print, and 7 is coming soon.

Good luck. If you get some shaders going, I'd love to see them :)