Chapter 6. Shader Management

With the basic graphics engine now up and running you can focus on shader development for a while. As mentioned in the last chapter, everything that is rendered in XNA is done with the help of shaders, even if you don't interact with shaders directly when using the SpriteBatch class or the SimpleEffect class to simulate fixed function behavior. This chapter goes through the whole process of writing a shader from the ground up, and then you learn all about vertex buffers, the vertex shader process, and how pixel shaders finally bring the pixels on the screen. If you are already a shader expert, you probably want to skip this chapter or just quickly fly over it. But because the next chapters all rely on a fundamental knowledge of shaders, I want to make sure everyone is on the same level.

Because shaders are so very important in XNA, you should really try to follow all steps in this chapter if you don't have a strong foundation in shaders yet. The chapter is designed to let you follow every single step, and by the end of the chapter you will have written your first shader and you will not only understand all the steps in the process of shader creation, but also how to use them easily. Then you will be ready for the next chapters and you will be able to write your own shaders easily.

Before starting with cool normal mapping effects or post screen shaders in the next chapters, you have to learn the basics first. Shaders are not just used for high-quality effects; ...

Get Professional XNA™ Programming: Building Games for Xbox 360™ and Windows® with XNA Game Studio 2.0, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.