Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Dedication
Acknowledgments
Introduction
Download the Book’s Source Code
Create a Win32 Project
Linking the DirectX Libraries
Adding the Source Code and Building the Project
Chapter 1 Vector Algebra
1.1.1 Vectors and Coordinate Systems
1.1.2 Left-Handed Versus Right-Handed Coordinate Systems
1.1.3 Basic Vector Operations
1.3.1 Orthogonalization
1.4.1 Pseudo 2D Cross Product
1.4.2 Orthogonalization with the Cross Product
1.6.1 Vector Types
1.6.2 Loading and Storage Methods
1.6.3 Parameter Passing
1.6.4 Constant Vectors
1.6.5 Overloaded Operators
1.6.6 Miscellaneous
1.6.7 Setter Functions
1.6.8 Vector Functions
1.6.9 Floating-Point Error
Chapter 2 Matrix Algebra
2.2.1 Definition
2.2.2 Vector-Matrix Multiplication
2.2.3 Associativity
2.5.1 Matrix Minors
2.5.2 Definition
2.8.1 Matrix Types
2.8.2 Matrix Functions
2.8.3 DirectX Math Matrix Sample Program
Chapter 3 Transformations
3.1.1 Definition
3.1.2 Matrix Representation
3.1.3 Scaling
3.1.4 Rotation
3.2.1 Homogeneous Coordinates
3.2.2 Definition and Matrix Representation
3.2.3 Translation
3.2.4 Affine Matrices for Scaling and Rotation
3.2.5 Geometric Interpretation of an Affine Transformation Matrix
3.4.1 Vectors
3.4.2 Points
3.4.3 Matrix Representation
3.4.4 Associativity and Change of Coordinate Matrices
3.4.5 Inverses and Change of Coordinate Matrices
Chapter 4 Direct3D Initialization
4.1.1 Direct3D 12 Overview
4.1.2 COM
4.1.3 Textures Formats
4.1.4 The Swap Chain and Page Flipping
4.1.5 Depth Buffering
4.1.6 Resources and Descriptors
4.1.7 Multisampling Theory
4.1.8 Multisampling in Direct3D
4.1.9 Feature Levels
4.1.10 DirectX Graphics Infrastructure
4.1.11 Checking Feature Support
4.1.12 Residency
4.2.1 The Command Queue and Command Lists
4.2.2 CPU/GPU Synchronization
4.2.3 Resource Transitions
4.2.4 Multithreading with Commands
4.3.1 Create the Device
4.3.2 Create the Fence and Descriptor Sizes
4.3.3 Check 4X MSAA Quality Support
4.3.4 Create Command Queue and Command List
4.3.5 Describe and Create the Swap Chain
4.3.6 Create the Descriptor Heaps
4.3.7 Create the Render Target View
4.3.8 Create the Depth/Stencil Buffer and View
4.3.9 Set the Viewport
4.3.10 Set the Scissor Rectangles
4.4.1 The Performance Timer
4.4.2 Game Timer Class
4.4.3 Time Elapsed Between Frames
4.4.4 Total Time
4.5.1 D3DApp
4.5.2 Non-Framework Methods
4.5.3 Framework Methods
4.5.4 Frame Statistics
4.5.5 The Message Handler
4.5.6 The “Init Direct3D” Demo
Chapter 5 The Rendering Pipeline
5.3.1 Color Operations
5.3.2 128-Bit Color
5.3.3 32-Bit Color
5.5.1 Vertices
5.5.2 Primitive Topology
5.5.2.1 Point List
5.5.2.2 Line Strip
5.5.2.3 Line List
5.5.2.4 Triangle Strip
5.5.2.5 Triangle List
5.5.2.6 Primitives with Adjacency
5.5.2.7 Control Point Patch List
5.5.3 Indices
5.6.1 Local Space and World Space
5.6.2 View Space
5.6.3 Projection and Homogeneous Clip Space
5.6.3.1 Defining a Frustum
5.6.3.2 Projecting Vertices
5.6.3.3 Normalized Device Coordinates (NDC)
5.6.3.4 Writing the Projection Equations with a Matrix
5.6.3.5 Normalized Depth Value
5.6.3.6 XMMatrixPerspectiveFovLH
5.10.1 Viewport Transform
5.10.2 Backface Culling
5.10.3 Vertex Attribute Interpolation
Chapter 6 Drawing in Direct3D
6.4.1 Input Layout Description and Input Signature Linking
6.6.1 Creating Constant Buffers
6.6.2 Updating Constant Buffers
6.6.3 Upload Buffer Helper
6.6.4 Constant Buffer Descriptors
6.6.5 Root Signature and Descriptor Tables
6.7.1 Offline Compilation
6.7.2 Generated Assembly
6.7.3 Using Visual Studio to Compile Shaders Offline
Chapter 7 Drawing in Direct 3D Part II
7.4.1 Generating a Cylinder Mesh
7.4.1.1 Cylinder Side Geometry
7.4.1.2 Cap Geometry
7.4.2 Generating a Sphere Mesh
7.4.3 Generating a Geosphere Mesh
7.5.1 Vertex and Index Buffers
7.5.2 Render Items
7.5.3 Frame Resources and Constant Buffer Views
7.5.4 Drawing the Scene
7.6.1 Root Parameters
7.6.2 Descriptor Tables
7.6.3 Root Descriptors
7.6.4 Root Constants
7.6.5 A More Complicated Root Signature Example
7.6.6 Root Parameter Versioning
7.7.1 Generating the Grid Vertices
7.7.2 Generating the Grid Indices
7.7.3 Applying the Height Function
7.7.4 Root CBVs
7.7.5 Dynamic Vertex Buffers
Chapter 8 Lighting
8.2.1 Computing Normal Vectors
8.2.2 Transforming Normal Vectors
8.7.1 Fresnel Effect
8.7.2 Roughness
8.11.1 Attenuation
8.13.1 Light Structure
8.13.2 Common Helper Functions
8.13.3 Implementing Directional Lights
8.13.4 Implementing Point Lights
8.13.5 Implementing Spotlights
8.13.6 Accumulating Multiple Lights
8.13.7 The Main HLSL File
8.14.1 Vertex Format
8.14.2 Normal Computation
8.14.3 Updating the Light Direction
8.14.4 Update to Root Signature
Chapter 9 Texturing
9.3.1 DDS Overview
9.3.2 Creating DDS Files
9.4.1 Loading DDS Files
9.4.2 SRV Heap
9.4.3 Creating SRV Descriptors
9.4.4 Binding Textures to the Pipeline
9.5.1 Magnification
9.5.2 Minification
9.5.3 Anisotropic Filtering
9.7.1 Creating Samplers
9.7.2 Static Samplers
9.9.1 Specifying Texture Coordinates
9.9.2 Creating the Texture
9.9.3 Setting the Texture
9.9.4 Updated HLSL
9.11.1 Grid Texture Coordinate Generation
9.11.2 Texture Tiling
9.11.3 Texture Animation
Chapter 10 Blending
10.5.1 No Color Write
10.5.2 Adding/Subtracting
10.5.3 Multiplying
10.5.4 Transparency
10.5.5 Blending and the Depth Buffer
Chapter 11 Stenciling
11.3.1 Depth Settings
11.3.2 Stencil Settings
11.3.3 Creating and Binding a Depth/Stencil State
11.4.1 Mirror Overview
11.4.2 Defining the Mirror Depth/Stencil States
11.4.3 Drawing the Scene
11.4.4 Winding Order and Reflections
11.5.1 Parallel Light Shadows
11.5.2 Point Light Shadows
11.5.3 General Shadow Matrix
11.5.4 Using the Stencil Buffer to Prevent Double Blending
11.5.5 Shadow Code
Chapter 12 The Geometry Shader
12.2.1 Overview
12.2.2 Vertex Structure
12.2.3 The HLSL File
12.2.4 SV_PrimitiveID
12.3.1 Overview
12.3.2 Sampling a Texture Array
12.3.3 Loading Texture Arrays
12.3.4 Texture Subresources
Chapter 13 The Compute Shader
13.2.1 Compute PSO
13.3.1 Texture Inputs
13.3.2 Texture Outputs and Unordered Access Views (UAVs)
13.3.3 Indexing and Sampling Textures
13.3.4 Structured Buffer Resources
13.3.5 Copying CS Results to System Memory
13.7.1 Blurring Theory
13.7.2 Render-to-Texture
13.7.3 Blur Implementation Overview
13.7.4 Compute Shader Program
Chapter 14 The Tessellation Stages
14.1.1 Tessellation and the Vertex Shader
14.2.1 Constant Hull Shader
14.2.2 Control Point Hull Shader
14.3.1 Quad Patch Tessellation Examples
14.3.2 Triangle Patch Tessellation Examples
14.6.1 Bézier Curves
14.6.2 Cubic Bézier Surfaces
14.6.3 Cubic Bézier Surface Evaluation Code
14.6.4 Defining the Patch Geometry
Chapter 15 Building a First Person Camera and Dynamic Indexing
15.3.1 XMVECTOR Return Variations
15.3.2 SetLens
15.3.3 Derived Frustum Info
15.3.4 Transforming the Camera
15.3.5 Building the View Matrix
Chapter 16 Instancing and Frustum Culling
16.1.1 Drawing Instanced Data
16.1.2 Instance Data
16.1.3 Creating the Instanced Buffer
16.2.1 DirectX Math Collision
16.2.2 Boxes
16.2.2.1 Rotations and Axis-Aligned Bounding Boxes
16.2.3 Spheres
16.2.4 Frustums
16.2.4.1 Constructing the Frustum Planes
16.2.4.2 Frustum/Sphere Intersection
16.2.4.3 Frustum/AABB Intersection
Chapter 17 Picking
17.3.1 Ray/AABB Intersection
17.3.2 Ray/Sphere Intersection
17.3.3 Ray/Triangle Intersection
Chapter 18 Cube Mapping
18.2.1 Loading and Using Cube Maps in Direct3D
18.5.1 Dynamic Cube Map Helper Class
18.5.2 Building the Cube Map Resource
18.5.3 Extra Descriptor Heap Space
18.5.4 Building the Descriptors
18.5.5 Building the Depth Buffer
18.5.6 Cube Map Viewport and Scissor Rectangle
18.5.7 Setting up the Cube Map Camera
18.5.8 Drawing into the Cube Map
Chapter 19 Normal Mapping
Chapter 20 Shadow Mapping
20.3.1 Code Implementation
20.3.2 Points Outside the Frustum
20.3.3 Orthographic Projections
20.4.1 Algorithm Description
20.4.2 Biasing and Aliasing
20.4.3 PCF Filtering
20.4.4 Building the Shadow Map
20.4.5 The Shadow Factor
20.4.6 The Shadow Map Test
20.4.7 Rendering the Shadow Map
20.5.1 The DDX and DDY Functions
20.5.2 Solution to the Large PCF Kernel Problem
20.5.3 An Alternative Solution to the Large PCF Kernel Problem
Chapter 21 Ambient Occlusion
21.2.1 Render Normals and Depth Pass
21.2.2 Ambient Occlusion Pass
21.2.2.1 Reconstruct View Space Position
21.2.2.2 Generate Random Samples
21.2.2.3 Generate the Potential Occluding Points
21.2.2.4 Perform the Occlusion Test
21.2.2.5 Finishing the Calculation
21.2.2.6 Implementation
21.2.3 Blur Pass
21.2.4 Using the Ambient Occlusion Map
Chapter 22 Quaternions
22.1.1 Definitions
22.1.2 Geometric Interpretation
22.1.3 Polar Representation and Rotations
22.2.1 Definition and Basic Operations
22.2.2 Special Products
22.2.3 Properties
22.2.4 Conversions
22.2.5 Conjugate and Norm
22.2.6 Inverses
22.2.7 Polar Representation
22.3.1 Rotation Operator
22.3.2 Quaternion Rotation Operator to Matrix
22.3.3 Matrix to Quaternion Rotation Operator
22.3.4 Composition
Chapter 23 Character Animation
23.1.1 Mathematical Formulation
23.2.1 Definitions
23.2.2 Reformulating the Bones To-Root Transform
23.2.3 The Offset Transform
23.2.4 Animating the Skeleton
23.2.5 Calculating the Final Transform
23.4.1 Header
23.4.2 Materials
23.4.3 Subsets
23.4.4 Vertex Data and Triangles
23.4.5 Bone Offset Transforms
23.4.6 Hierarchy
23.4.7 Animation Data
23.4.8 M3DLoader
Appendix A: Introduction to Windows Programming
A.1.1 Resources
A.1.2 Events, the Message Queue, Messages, and the Message Loop
A.1.3 GUI
A.1.4 Unicode
A.3.1 Includes, Global Variables, and Prototypes
A.3.2 WinMain
A.3.3 WNDCLASS and Registration
A.3.4 Creating and Displaying the Window
A.3.5 The Message Loop
A.3.6 The Window Procedure
A.3.7 The MessageBox Function
Appendix B: High Level Shader Language Reference
Scalar Types
Vector Types
Swizzles
Matrix Types
Arrays
Structures
The typedef Keyword
Variable Prefixes
Casting
Keywords
Operators
User Defined Functions
Built-in Functions
Constant Buffer Packing
Appendix C: Some Analytic Geometry
C.4.1 DirectX Math Planes
C.4.2 Point/Plane Spatial Relation
C.4.3 Construction
C.4.4 Normalizing a Plane
C.4.5 Transforming a Plane
C.4.6 Nearest Point on a Plane to a Given Point
C.4.7 Ray/Plane Intersection
C.4.8 Reflecting Vectors
C.4.9 Reflecting Points
C.4.10 Reflection Matrix
Appendix D: Solutions to Selected Exercises
Appendix E: Bibliography and Further Reading
Index
Intended Audience
Prerequisites
Required Development Tools and Hardware
Using the DirectX SDK Documentation and SDK Samples
Clarity
Sample Programs and Online Supplements
Demo Project Setup in Visual Studio 2010
PART I MATHEMATICAL PREREQUISITES
1.1 Vectors
1.2 Length and Unit Vectors
1.3 The Dot Product
1.4 The Cross Product
1.5 Points
1.6 DirectX Math Vectors
1.7 Summary
1.8 Exercises
2.1 Definition
2.2 Matrix Multiplication
2.3 The Transpose of a Matrix
2.4 The Identity Matrix
2.5 The Determinant of a Matrix
2.6 The Adjoint of a Matrix
2.7 The Inverse of a Matrix
2.8 DirectX Math Matrices
2.9 Summary
2.10 Exercises
3.1 Linear Transformations
3.2 Affine Transformations
3.3 Composition of Transformations
3.4 Change of Coordinate Transformations
3.5 Transformation Matrix versus Change of Coordinate Matrix
3.6 DirectX Math Transformation Functions
3.7 Summary
3.8 Exercises
PART II DIRECT 3D FOUNDATIONS
4.1 Preliminaries
4.2 CPU/GPU Interaction
4.3 Initializing Direct3D
4.4 Timing and Animation
4.5 The Demo Application Framework
4.6 Debugging Direct3D Applications
4.7 Summary
5.1 The 3D Illusion
5.2 Model Representation
5.3 Basic Computer Color
5.4 Overview of the Rendering Pipeline
5.5 The Input Assembler Stage
5.6 The Vertex Shader Stage
5.7 The Tessellation Stages
5.8 The Geometry Shader Stage
5.9 Clipping
5.10 The Rasterization Stage
5.11 The Pixel Shader Stage
5.12 The Output Merger Stage
5.13 Summary
5.14 Exercises
6.1 Vertices and Input Layouts
6.2 Vertex Buffers
6.3 Indices and Index Buffers
6.4 Example Vertex Shader
6.5 Example Pixel Shader
6.6 Constant Buffers
6.7 Compiling Shaders
6.8 Rasterizer State
6.9 Pipeline State Object
6.10 Geometry Helper Structure
6.11 Box Demo
6.12 Summary
6.13 Exercises
7.1 Frame Resources
7.2 Render Items
7.3 Pass Constants
7.4 Shape Geometry
7.5 Shapes Demo
7.6 More on Root Signatures
7.7 Land and Waves Demo
7.8 Summary
7.9 Exercises
8.1 Light and Material Interaction
8.2 Normal Vectors
8.3 Important Vectors in Lighting
8.4 Lambert’s Cosine Law
8.5 Diffuse Lighting
8.6 Ambient Lighting
8.7 Specular Lighting
8.8 Lighting Model Recap
8.9 Implementing Materials
8.10 Parallel Lights
8.11 Point Lights
8.12 Spotlights
8.13 Lighting Implementation
8.14 Lighting Demo
8.15 Summary
8.16 Exercises
9.1 Texture and Resource Recap
9.2 Texture Coordinates
9.3 Texture Data Sources
9.4 Creating and Enabling a Texture
9.5 Filters
9.6 Address Modes
9.7 Sampler Objects
9.8 Sampling Textures in a Shader
9.9 Crate Demo
9.10 Transforming Textures
9.11 Textured Hills and Waves Demo
9.12 Summary
9.13 Exercises
10.1 The Blending Equation
10.2 Blend Operations
10.3 Blend Factors
10.4 Blend State
10.5 Examples
10.6 Alpha Channels
10.7 Clipping Pixels
10.8 Fog
10.9 Summary
10.10 Exercises
11.1 Depth/Stencil Formats and Clearing
11.2 The Stencil Test
11.3 Describing the Depth/Stencil State
11.4 Implementing Planar Mirrors
11.5 Implementing Planar Shadows
11.6 Summary
11.7 Exercises
12.1 Programming Geometry Shaders
12.2 Tree Billboards Demo
12.3 Texture Arrays
12.4 Alpha-to-Coverage
12.5 Summary
12.6 Exercises
13.1 Threads and Thread Groups
13.2 A Simple Compute Shader
13.3 Data Input and Output Resources
13.4 Thread Identification System Values
13.5 Append and Consume Buffers
13.6 Shared Memory and Synchronization
13.7 Blur Demo
13.8 Further Resources
13.9 Summary
13.10 Exercises
14.1 Tessellation Primitive Types
14.2 The Hull Shader
14.3 The Tessellation Stage
14.4 The Domain Shader
14.5 Tessellating a Quad
14.6 Cubic Bézier Quad Patches
14.7 Summary
14.8 Exercises
PART III TOPICS
15.1 View Transform Review
15.2 The Camera Class
15.3 Selected Method Implementations
15.4 Camera Demo Comments
15.5 Dynamic Indexing
15.6 Summary
15.7 Exercises
16.1 Hardware Instancing
16.2 Bounding Volumes and Frustums
16.3 Frustum Culling
16.4 Summary
16.5 Exercises
17.1 Screen to Projection Window Transform
17.2 World/Local Space Picking Ray
17.3 Ray/Mesh Intersection
17.4 Demo Application
17.5 Summary
17.6 Exercises
18.1 Cube Mapping
18.2 Environment Maps
18.3 Texturing a Sky
18.4 Modeling Reflections
18.5 Dynamic Cube Maps
18.6 Dynamic Cube Maps with the Geometry Shader
18.7 Summary
18.8 Exercises
19.1 Motivation
19.2 Normal Maps
19.3 Texture/Tangent Space
19.4 Vertex Tangent Space
19.5 Transforming Between Tangent Space and Object Space
19.6 Normal Mapping Shader Code
19.7 Summary
19.8 Exercises
20.1 Rendering Scene Depth
20.2 Orthographic Projections
20.3 Projective Texture Coordinates
20.4 Shadow Mapping
20.5 Large PCF Kernels
20.6 Summary
20.7 Exercises
21.1 Ambient Occlusion via Ray Casting
21.2 Screen Space Ambient Occlusion
21.3 Summary
21.4 Exercises
22.1 Review of the Complex Numbers
22.2 Quaternion Algebra
22.3 Unit Quaternions and Rotations
22.4 Quaternion Interpolation
22.5 DirectX Math Quaternion Functions
22.6 Rotation Demo
22.7 Summary
22.8 Exercises
23.1 Frame Hierarchies
23.2 Skinned Meshes
23.3 Vertex Blending
23.4 Loading Animation Data from File
23.5 Character Animation Demo
23.6 Summary
23.7 Exercises
A.1 Overview
A.2 Basic Windows Application
A.3 Explaining the Basic Windows Application
A.4 A Better Message Loop
A.5 Summary
A.6 Exercises
Variable Types
Keywords and Operators
Program Flow
Functions
C.1 Rays, Lines, and Segments
C.2 Parallelograms
C.3 Triangles
C.4 Planes
C.5 Exercises
← Prev
Back
Next →
← Prev
Back
Next →