Book Details

ISBN 139781849690041

Paperback292 pages

Book Description

XNA is a very powerful API using which it's easy to make great games, especially when you have dazzling 3D effects. This book will put you on course to implement the same 3D graphics used in professional games to make your games shine, and get those gamers addicted! If you think 3D graphics is something that limits your games, then this book is for you.

3D Graphics with XNA Game Studio 4.0 is a step by step companion to implement the effects used in professional 3D games in your XNA games. By the time you're done with this book your games would have eye-catching visuals and 3D effects.

The one thing that can make or break a game is its appearance; players will mostly be attracted to a game if it looks good. With this book you will create your 3D objects and models and make them look more interesting by using shadowing and lighting techniques, and make them move in nasty ways using animation. Want to create realistic terrians for your games? Need some place for your 3D models to engage in battle? This book will enable you to do all that and more, by walking you through the implementation of numerous effects and graphics techniques used in professional games so that you can make them look great.

Table of Contents

Chapter 1: Getting Started with 3D

Setting up a new project

The 3D coordinate system

Matrices

Loading a model

Drawing a model

Creating a Custom Model class

Creating a Camera class

Calculating bounding spheres for models

View frustum culling

Additional camera types: Arc-Ball

Additional camera types: chase camera

Example—spaceship simulator

Summary

Chapter 2: Introduction to HLSL

Getting started

Assigning a shader to a model

Creating a simple effect

Texture mapping

Texture sampling

Diffuse colors

Ambient lighting

Lambertian directional lighting

Phong specular highlights

Creating
a Material class to store effect parameters

Summary

Chapter 3: Advanced Lighting

Implementing a point light with HLSL

Implementing a spot light with HLSL

Drawing multiple lights

Prelighting

Storing depth and normal values

Creating the light map

Drawing models with the light map

Creating the prelighting renderer

Using the prelighting renderer

Summary

Chapter 4: Projection and Shadowing Effects

Projective texturing

Shadow mapping—drawing the depth map

Variance shadow mapping—soft shadows

Variance shadow mapping—generating shadows

Summary

Chapter 5: Shader Effects

Fog

Normal mapping

Generating normal maps with Photoshop

Cube mapping: Making a sky sphere

Cube mapping: Reflections

Rendering sky boxes with Terragen

Creating a reflective water effect

Summary

Chapter 6: Billboard and Particle Effects

Creating the BillboardSystem class

Drawing Billboards

Creating clouds with spherical billboarding

Non-rotating billboards

Particle effects

Particle fire

Particle smoke

Summary

Chapter 7: Environmental Effects

Building a terrain from a heightmap

Multitexturing

Adding a detail texture to the terrain

Placing plants on the terrain

Adding the finishing touches

Summary

Chapter 8: Advanced Materials and Post Processing

Advanced Materials

Post processing

Black and white post processor

Gaussian blur post processor

Depth of field

Glow post processor

Summary

Chapter 9: Animation

Object animation

Keyframed animation

Curve interpolation

Building a Race Track from a Curve

Moving a car along the track

Hierarchical animation

Skinned animation

Loading a skinned model

Playing a skinned animation

Changing an animation's play speed

Model attachments

Summary

What You Will Learn

Understand the fundamentals of 3D graphics and math.

Create a flexible framework for building games

Learn how to implement some of the most common and uncommon graphics techniques such as lighting and animation, using the XNA Framework.

Work with HLSL and shaders.

Create an architecture rendering and creating special effects.

Improve your games with optimization techniques.

Authors

Sean James

Sean James is a computer science student who has been programming for many years. He started with web design, learning HTML, PHP, Javascript, etc. Since then has created many websites including his personal XNA and game development focused blog http://www.innovativegames.net. In addition to web design he has interests in desktop software development and development for mobile devices such as Android, Windows Mobile, and Zune. However, his passion is for game development with DirectX, OpenGL, and XNA.

Sean James lives in Claremont, CA with his family and two dogs. He would like to thank his family and friends who supported him throughout the writing of this book, and all the people at Packt Publishing who worked hard on the book and to support him. He would also like to thank the XNA community for providing such amazing resources, without which this book would not have been possible.

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.