Summary


In this chapter I tried to make sure that you finally understand how shaders work, why you have to do certain things like declaring vertex formats, and how vertex data is processed through the shaders. Most of the time when I talk to other developers who have not worked with shaders before they are afraid of shaders and do not have a clear concept of what they are all about. If you have worked with shaders before, this chapter might not be the most exciting one, but maybe you learned some details you didn’t know about yet.

The following steps describe how 3D data is processed in XNA:

  • Get the 3D geometry data from the Model class (or define it yourself with vertex buffers).

  • Make sure your shader and your XNA code use the same vertex formats.

  • Call the shader technique and execute each pass by rendering your 3D data.

  • The vertex shader processes the input data and passes it to the pixel shader with the VertexOutput structure. The positions get transformed from world coordinates to the screen position.

  • The pixel shader finally brings each pixel of every rendered visible polygon on the screen. Always try to make the pixel shader as short and fast as possible.

In the next chapter you are going to use the acquired knowledge and create great looking NormalMapping shader effects. Then you will be ready to create your next game in Chapter 8, where you also add cool post screen shader effects.




Professional XNA Game Programming
Professional XNA Programming: Building Games for Xbox 360 and Windows with XNA Game Studio 2.0
ISBN: 0470261285
EAN: 2147483647
Year: 2007
Pages: 138

Similar book on Amazon
XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360 (Developer's Library)
XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360 (Developer's Library)
Learning XNA 3.0: XNA 3.0 Game Development for the PC, Xbox 360, and Zune
Learning XNA 3.0: XNA 3.0 Game Development for the PC, Xbox 360, and Zune
Beginning XNA 2.0 Game Programming: From Novice to Professional (Expert's Voice in Game Programming)
Beginning XNA 2.0 Game Programming: From Novice to Professional (Expert's Voice in Game Programming)
Microsoftu00ae XNAu00ae Game Studio 3.0: Learn Programming Now! (Pro - Developer)
Microsoftu00ae XNAu00ae Game Studio 3.0: Learn Programming Now! (Pro - Developer)

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net