O'Reilly logo

Professional XNA™ Programming: Building Games for Xbox 360™ and Windows® with XNA Game Studio 2.0, Second Edition by Benjamin Nitschke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required