Anatomy of a Game – Part 5

November 7th, 2007 by nazeeh Leave a reply »

This post will talk about Effects. Effects are probably one of the coolest aspects of graphics programming. To understand them, you first need to have some background history.

Graphics initially were entirely rendered by the CPU. This meant that all the calculations that were involved in transforming a 3D world to a 2D image were done by the CPU. It gave decent results, but performance was not very good. That’s when the first 3D accelerator cards started to show up on the market. These cards could do a lot of those calculations on a dedicated CPU that lived on the graphics card. So instead of doing all the calculations, the CPU would send the vertices to the card along with where the camera was in the world, and the graphics card would figure out what image to draw on the screen.

The problem with these cards, though, was that they had what is called a fixed-function pipeline. That means that the algorithms that were used to calculate how to render the world were fixed on the card. They did the job pretty well, and even included lighting, but they did it in a limited way. So if you wanted to have any kind of cool effect on your world, you couldn’t do that on the card.

Programmable cards came to the rescue! These cards, which are the majority now, let you tell them exactly how to perform the calculations needed to render the final image. You write small programs called shaders that run on the card and that perform the work needed to generate the final image you see on the screen. This advance has allowed game developers to come up with all kinds of awesome effects that make their games look really cool, and since they run on the fast graphics processor, they don’t drag down performance. This shader code is referred to as effects.

So what can you do with effects? At the simplest level, you need to write them to tell the graphics card how to render the final image to the screen. That involves doing some simple math (that is very well documented and known) to tell the graphics card how to render the scene to the screen. You can also include more calculations to apply lighting to the scene. When you’re done rendering the image, you can have the graphics card run yet another piece of code on the final image to give it a blur effect, for example. If you’ve ever used a package like Photoshop and played around with the filters it has, then you can get a feeling as to what you can do with shaders. You can do all kinds of cool effects on the final rendered image that happen at real time. Things such as water, reflections, blur, bloom, and so on are possible thanks to effects.

Thanks for reading! I'd love to hear your thoughts, feel free to leave a comment below. Don't forget to subscribe to my RSS Feed!
Share and Enjoy:
  • Print
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Advertisement

9 comments

  1. Cameron says:

    Very informative stuff. A lot of people who develop games don’t seem to have the paitence to provide information like this to beginners. Thanks for sharing.

  2. nazeeh says:

    Glad you liked it :) I know the feeling though. I could hardly find that kind of information when I was learning (actually..I am still learning!)

    Thanks for the feedback!

  3. Andrew says:

    Great tut! Been looking for an XNA starting point, and I’m glad I found this.

  4. Luke says:

    I can’t thank you enough! top tutorial! I would have never figured all that out. my fav page is page 1. oh i like the GOW modle has less pollygons than i thought! Its all clear to me now Thanks A bunch n_n

  5. student says:

    Nice, good job!!

  6. Student2 says:

    Thanks for the article, helped me alot.

  7. John says:

    You rock! Reading this is so much easier than going through the XNA tutorial on the main website. I appreciate you laying the basic groundwork for me (which the XNA website DOES NOT do at all). It helped me understand the basic functions of a game and the XNA setup much better.

  8. nazeeh says:

    Glad this helped you out guys! I appreciate the feedback!

  9. Invalidx says:

    nazeeh’s tutorials are great. I agree they’re SO much better than the ‘official’ ones, and any of the other ones on the ‘net that I’ve found.

Leave a Reply