This article is prerecorded. Shawn is away (getting married at the end of the week). Replies to comments will be delayed.
Remember the story about the chessboard and the grains of rice? Shader programmers have the same problem. We start with a bunch of options (lighting, texturing, vertex color, fog, animation, environment mapping, multitexturing), and want to support every possible combination of settings, but each boolean option doubles the number of shaders required. Exponential growth gets out of hand faster than you can say "2 to the N".
Programmable shaders are the perfect solution to this dilemma. Sure, the total number of permutations may be huge, but most games only actually use a few squares of the chessboard. With programmability, each developer is free to implement the specific feature combinations needed for their particular game.
But we don’t have programmable shaders on Windows Phone right now.
Cue inevitable chorus of comments. Personally, I love shaders. I would love to someday enable them on Windows Phone. But we didn’t have time to make that happen for this first release, and we have nothing to announce about future plans, and that’s all I have to say about that 🙂
Instead we provide a set of built-in effects, each of which has several configurable knobs. These effects are available (and I think will be useful especially for beginners) on Windows and Xbox, but they are mostly designed and optimized for Windows Phone, since the phone lacks the alternative of programmable shaders.
What features should these built-in effects provide?
- We made a list of everything we thought would be useful for game developers. It was a LONG list.
- We removed the things that would not run fast enough to be practical on mobile hardware. The list got shorter, but was still pretty long.
- We looked at our schedule, and realized we had time to implement, optimize and test around 50 shaders.
- log2(50) allows approximately 6 boolean options, but our list had way more than 6 features!
Something had to give. The schedule was immovable. We cut the feature list, and cut some more, but it was too painful to cut all the way down to 6 features, so instead we abandoned the goal of supporting every possible combination of options. By choosing only the most useful combinations, we moved from the scary land of 2^N permutation explosion, into a more manageable linear problem space. Some features are supported consistently across the board, for instance all effects have the same World, View, and Projection matrices, and the same fog parameters. Others are supported by just a subset of effects, for instance BasicEffect and SkinnedEffect use the same lighting model, but DualTextureEffect does not support realtime lighting at all.
Game Studio 4.0 ended up with five built-in effects, implemented by 78 different shader permutations. Their features:
|World, View, Projection||Yes||Yes||Yes||Yes||Yes|