Real-time Shaders with XNA

Learn the fundamentals of real-time shaders and a time-saving workflow to creating real-time shaders with XNA. Software required: XNA Game Studio 2.0.
Course info
Level
Intermediate
Updated
Apr 9, 2008
Duration
4h 3m
Table of contents
Introduction and Project Overview
Real-time Shaders with XNA
Description
Course info
Level
Intermediate
Updated
Apr 9, 2008
Duration
4h 3m
Description

Learn the fundamentals of real-time shaders and a time-saving workflow to creating real-time shaders with XNA. Contains over 4 hours of project-based training for technical artists learning the methods of real-time shading using XNA. Popular highlights include: XNA Overview; Overview of Real-Time Shaders; Loading FBX Content Pipeline Files; Using Basic Effects; Writing Vertex and Pixel Shaders; Coding Effects and Techniques; Setting World, View and Projection Matrices; Altering View Matrix to Create Turntable; Using Skinned Model Processor; Constant and Texture Shading; Lambertian Diffuse Lighting Model; Blinn-Phong Shading Model; Faking Reflections with Cubemaps; Using Normal Maps; Specularity / Reflections using Normal Maps; Setting up Multiple Techniques; Computing Flat Shadows; Shadow Shaders; Working with the Stencil Buffer; Render to Texture; Drawing with Sprite Batch; Using Pixel Shaders for Post Effects. Software required: XNA Game Studio 2.0.

About the author
About the author

Originally from Lagos, Nigeria, Sunder has made great headway in both the interactive game design and 3D animation worlds.

Section Introduction Transcripts
Section Introduction Transcripts

Introduction and Project Overview
Hello, and welcome to Real Time Shaders with XNA, presented by Digital Tutors. My name is Sunder, and I'll be your personal instructor in this course, guiding you through the different techniques for shading your game characters inside of XNA. What makes the next generation games look next gen are the different real time shading methods which are utilized that often times rival those used in pre rendered sequences. During the next few hours, we're going to learn how to build real time shaders for animated characters in XNA, Microsoft's next gen framework, suitable for game development on PC and Xbox 360. We're going to start off nice and easy with constant and lambert shading, and then move on to more complicated effects, like reflective, bumpy, shiny surfaces, And pros process effects like map driven glows. We're going to build all of these from scratch using Game Studio C Sharp and HLSL. And we're going to learn a different formula and technique involved in pulling these effects. We have a lot of information about shaders, which is also useful to those interested in programming shaders for other platforms or other rendering engines. Much to do, much to learn, so let's jump right in by building our project. So we're going to get started by creating our new project inside of C Sharp. If you don't have C Sharp or XNA installed, you need to go to the XNA Creators Club website and go to the New Users section. You can get to that link directly by going to education/newtoxna. aspx. This particular link here will give you a bunch of instructions necessary to get XNA up and running. You'll need to install a version of C Sharp. Right now I'm using the experts edition, which is free and available to everybody. Once you have that installed you need to update it with the service pack, so that you can get ready to install again, Game Studio 2. 0. Once you have that installed, you're ready to start the lesson, or alternatively you can subscribe to the Creators Club, if you want to develop for the 360, and get access to content, or you can just get started by going through different starter projects in XNA, so you can get more familiar with the system. Once you have everything installed, up and ready, up and running and you're ready to go, just go into C Sharp, File, New Project, and here we'll need to go ahead and create our custom project that we're going to use for developing these shaders. Make sure your project type is set to XNA Game Studio 2. 0, so we can choose from one of the available templates. We're going to work with Windows Game 2. 0 so we can test immediately in Windows here. Let's now give it a suitable name. Instead of calling it Windows Game 1, I'm going to go ahead and call it Shader Project. You can call it whatever you like as well, just make sure that everywhere that I have Shader Project referenced, it refers to the file name that you have given. We can also decide on a location. For the location, I'm going to go ahead and use my root C drive, followed by Project Files folder. So this is the link I'm going to use. Which is Project Files in here. It's already here in the list. Now the Project Files folder that's on the training disk, or the available training material, essentially contains a different assets that we're going to use for shading our object. So our character that's animated, and the textures are available inside of this projects file folder. My recommendation is that you copy those project files into a suitable location, like the root of your C drive, and then you proceed to create the project in that particular folder. So in simple words, set a desired name, and then copy your files, or your training files from the disk, and then create your project in that particular folder. Once you have everything good to go, click okay to create the project. It'll create some default files in here that we can start tweaking to get our game up and running. If you click on the play icon here to start debugging, you can already pull up a window, and here we have our shader project already running. Now there's not much to it right now, but we're going to go ahead and bring our character in here soon enough. Let's go ahead and close this, and for now let's just change the name of the project that we're dealing with. Right now it's called Game 1, it's not a very suitable name in my opinion. So if you want to change the name of it, go to your Game 1. CS in your solution explorer, and in here, hit F2 to rename it, and now let's just call it Shader Li, just short for shader library. Now it's going to ask us we're going to rename a file. Would you like to rename all references to the game, to the name Game 1? Go ahead and click yes. Now it'll go ahead and change the name. So we have an appropriate class in here called Shader Li, that's based off this CS file. So now we'll go ahead and take a break at this point. In the next lesson we're going to learn how to bring our characters in by adding them to this project.