Introduction to 3D Game Programming with Direct3D 10.0



This page contains some general information about the book Introduction to 3D Game Programming with Direct3D 10.0, published by Jones and Bartlett Learning, that will help you decide if this book is for you.

Supplement Files:
Demo Project Setup in Visual Studio 2005
Demo Project Setup in Visual Studio 2008
Source Code Part I
Source Code Part II
Source Code Part III
Source Code Appendix A
Chapter 1 Solutions
Chapter 2 Solutions
Bolt Animations for Chapter 9
Errata

Quick Navigation

Summary

This book presents an introduction to programming interactive computer graphics, with an emphasis on game development, using Direct3D 10. It teaches the fundamentals of Direct3D and shader programming, after which the reader will be prepared to go on and learn more advanced techniques. The book is divided into three main parts. Part I explains the mathematical tools that will be used throughout this book. Part II shows how to implement fundamental tasks in Direct3D, such as initialization, defining 3D geometry, setting up cameras, creating vertex, pixel, and geometry shaders, lighting, texturing, blending, and stenciling. Part III is largely about applying Direct3D to implement a variety of interesting techniques and special effects, such as working with meshes, terrain rendering, picking, particle systems, environment mapping, normal mapping, shadows, and rendering to textures.

Intended Audience

This book was designed with the following three audiences in mind:

  • Intermediate level C++ programmers who would like an introduction to 3D programming using the latest iteration of Direct3D.
  • 3D programmers experienced with an API other than DirectX (e.g., OpenGL) who would like an introduction to Direct3D 10.
  • Experienced Direct3D 9 programmers wishing to learn the latest iteration of Direct3D.

Prerequisites

It should be emphasized that this is an introduction to Direct3D 10, shader programming, and game programming; it is not an introduction to general computer programming. The reader should satisfy the following prerequisites:

  • High School mathematics: algebra, trigonometry, and (mathematical) functions, for example.
  • Competent with Visual Studio: should know how to create projects, add files, and specify external libraries to link, for example.
  • Intermediate C++ and data structure skills: comfortable with pointers, arrays, operator overloading, linked lists, inheritance and polymorphism, for example.
  • Familiarity with Windows programming with the Win32 API is helpful, but not required; we provide a Win32 primer in Appendix A.

Required Development Tools and Recommended Hardware

To program Direct3D 10 applications, you will need the DirectX 10 SDK; the latest version can be downloaded here. Once downloaded, follow the instructions given by the installation wizard. As of the March 2008 DirectX SDK release, the SDK will only officially support versions of Visual Studio 2005 and Visual Studio 2008. Direct3D 10 requires Direct3D 10 capable hardware. The demos in this book were tested on a Geforce 8800 GTS.

Brief Table of Contents

  • Introduction
  • Part I Mathematical Prerequisites
    • Chapter 1 Vector Algebra
    • Chapter 2 Matrix Algebra
    • Chapter 3 Transformations
  • Part II Direct3D Foundations
    • Chapter 4 Direct3D Initialization
    • Chapter 5 The Rendering Pipeline
    • Chapter 6 Lighting
    • Chapter 7 Texturing
    • Chapter 8 Blending
    • Chapter 9 Stenciling
    • Chapter 10 The Geometry Shader
  • Part III Topics
    • Chapter 11 Cube Mapping
    • Chapter 12 Normal Mapping
    • Chapter 13 Shadow Mapping
    • Chapter 14 Meshes
    • Chapter 15 Picking
    • Chapter 16 Terrain Rendering
    • Chapter 17 Particle Systems
  • Appendix A Introduction to Windows Programming
  • Appendix B High Level Shader Language Reference
  • Appendix C Some Analytic Geometry

Chapter Descriptions

Chapter 1, Vector Algebra: Vectors are, perhaps, the most fundamental mathematical objects used in computer games. We use vectors to represent positions, displacements, directions, velocities, and forces, for example. In this chapter, we study vectors and the operations used to manipulate them.
Chapter 2, Matrix Algebra: Matrices provide an efficient and compact way of representing transformations. In this chapter, we become familiar with matrices and the operations defined on them.
Chapter 3, Transformations: This chapter examines three fundamental geometric transformations: scaling, rotation, and translation. We use these transformations to manipulate 3D objects in space. In addition, we explain change of coordinate transformations, which are used to transform coordinates representing geometry from one coordinate system into another.
null
Chapter 4, Direct3D Initialization: In this chapter, we learn what Direct3D is about and how to initialize it in preparation for 3D drawing. Basic Direct3D topics are also introduced, such as surfaces, pixel formats, page flipping, depth buffering, and multisampling. We also learn how to measure time with the performance counter, which we use to compute the frames rendered per second. In addition, we show how to output 2D text, and give some tips on debugging Direct3D applications. We develop and use our own application framework--not the SDK's framework.
null
Chapter 5, The Rendering Pipeline: In this long chapter, we provide a thorough introduction to the rendering pipeline, which is the sequence of steps necessary to generate a 2D image of the world based on what the virtual camera sees. We learn how to define 3D worlds, control the virtual camera, and draw 3D scenes.
null
Chapter 6, Lighting: This chapter shows how to create light sources and define the interaction between light and surfaces via materials. In particular, we show how to implement directional lights, point lights, and spotlights with vertex and pixel shaders.
null
Chapter 7, Texturing: This chapter describes texture mapping, which is a technique used to increase the realism of the scene by mapping 2D image data onto a 3D primitive. For example, using texture mapping, we can model a brick wall by applying a 2D brick wall image onto a 3D rectangle. Other key texturing topics covered include texture tiling and animated texture transformations.
null
Chapter 8, Blending: In this chapter, we look at a technique called blending, which allows us to implement a number of special effects like transparency. In addition, we discuss the intrinsic clip function, which enables us to mask out certain parts of an image from showing up; this can be used to implement fences and gates, for example. We also show how to implement a fog effect.
null
Chapter 9, Stenciling: This chapter describes the stencil buffer, which, like a stencil, allows us to block pixels from being drawn. To illustrate the ideas of this chapter, we include a thorough discussion on implementing planar reflections using the stencil buffer. An exercise describes an algorithm for using the stencil buffer to render the depth complexity of a scene, and asks you to implement the algorithm.
null
Chapter 10, The Geometry Shader: This chapter shows how to program geometry shaders, which are special because they can create or destroy entire geometric primitives. Some applications include billboards, subdivisions, and particle systems. In addition, this chapter explains primitive IDs and texture arrays.
null
Chapter 11, Cube Mapping: In this chapter, we show how to reflect environments onto arbitrary meshes with environment mapping; in addition, we use an environment map to texture a sky-sphere.
null
Chapter 12, Normal Mapping: This chapter shows how to get detailed real-time lighting results using normal maps.
null
Chapter 13, Shadow Mapping: Shadow mapping is a real-time shadowing technique, which shadows arbitrary geometry (it is not limited to planar shadows). In addition, we learn how to render to a texture, and how projective texturing works.
null
Chapter 14, Meshes: This chapter shows how to load complex models from files and work with the ID3DX10Mesh interface.
null
Chapter 15, Picking: This chapter shows how to determine the particular 3D object (or 3D primitive) that the user has selected with the mouse. Picking is often a necessity in 3D games and applications where the user interacts with the 3D world with the mouse. We also show how to compute the bounding box and sphere of a mesh.
null
Chapter 16, Terrain Rendering: This chapter shows how to create, texture, light, and render 3D terrains using heightmaps and a multi-texturing technique. Furthermore, we show how to smoothly "walk" the camera over the terrain.
null
Chapter 17, Particle Systems: In this chapter, we learn how to model systems that consist of many small particles that all behave in a similar manner. For example, particle systems can be used to model falling snow and rain, fire and smoke, rocket trails, sprinklers, and fountains.