HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Get Started Quickly with DirectX 3D Programming: No 3D Experience Needed
This step-by-step text demystifies modern graphics programming so you can quickly start writing professional code with DirectX and HLSL. Expert graphics instructor Paul Varcholik starts with the basics: a tour of the Direct3D graphics pipeline, a 3D math primer, and an introduction to the best tools and support libraries.
Next, you’ll discover shader authoring with HLSL. You’ll implement basic lighting models, including ambient lighting, diffuse lighting, and specular highlighting. You’ll write shaders to support point lights, spotlights, environment mapping, fog, color blending, normal mapping, and more.
Then you’ll employ C++ and the Direct3D API to develop a robust, extensible rendering engine. You’ll learn about virtual cameras, loading and rendering 3D models, mouse and keyboard input, and you’ll create a flexible effect and material system to integrate your shaders.
Finally, you’ll extend your graphics knowledge with more advanced material, including post-processing techniques for color filtering, Gaussian blurring, bloom, and distortion mapping. You’ll develop shaders for casting shadows, work with geometry and tessellation shaders, and implement a complete skeletal animation system for importing and rendering animated models.
You don’t need any experience with 3D graphics or the associated math: Everything’s taught hands-on, and all graphics-specific code is fully explained.
Coverage includes
• The Direct3D API and graphics pipeline
• A 3D math primer: vectors, matrices, coordinate systems, transformations, and the DirectX Math library
• Free and low-cost tools for authoring, debugging, and profiling shaders
• Extensive treatment of HLSL shader authoring
• Development of a C++ rendering engine
• Cameras, 3D models, materials, and lighting
• Post-processing effects
• Device input, component-based architecture, and software services
• Shadow mapping, depth maps, and projective texture mapping
• Skeletal animation
• Geometry and tessellation shaders
• Survey of rendering optimization, global illumination, compute shaders, deferred shading, and data-driven engine architecture
Introduction 1
PART I: AN INTRODUCTION TO 3D RENDERING 5
Chapter 1 Introducing DirectX 7
A Bit of History 8
The Direct3D 11 Graphics Pipeline 9
Summary 21
Chapter 2 A 3D/Math Primer 23
Vectors 24
Matrices 27
Transformations 31
DirectXMath 35
Summary 41
Chapter 3 Tools of the Trade 43
Microsoft Visual Studio 44
NVIDIA FX Composer 47
Visual Studio Graphics Debugger 53
Graphics Debugging Alternatives 55
Summary 56
Exercises 56
PART II: SHADER AUTHORING WITH HLSL 57
Chapter 4 Hello, Shaders! 59
Your First Shader 60
Hello, Structs! 68
Summary 70
Exercises 71
Chapter 5 Texture Mapping 73
An Introduction to Texture Mapping 74
A Texture Mapping Effect 75
Texture Filtering 81
Texture Addressing Modes 86
Summary 89
Exercises 89
Chapter 6 Lighting Models 91
Ambient Lighting 92
Diffuse Lighting 97
Specular Highlights 105
Summary 114
Exercises 114
Chapter 7 Additional Lighting Models 115
Point Lights 116
Spotlights 124
Multiple Lights 130
Summary 139
Exercises 139
Chapter 8 Gleaming the Cube 141
Texture Cubes 142
Skyboxes 145
Environment Mapping 149
Fog 154
Color Blending 159
Summary 167
Exercises 168
Chapter 9 Normal Mapping and Displacement Mapping 169
Normal Mapping 170
Displacement Mapping 178
Summary 181
Exercises 181
PART III: RENDERING WITH DIRECTX 183
Chapter 10 Project Setup and Window Initialization 185
A New Beginning 186
Project Setup 186
The Game Loop 195
Window Initialization 199
Summary 204
Exercise 204
Chapter 11 Direct3D Initialization 205
Initializing Direct3D 206
Putting It All Together 219
Summary 232
Exercise 232
Chapter 12 Supporting Systems 233
Game Components 234
Device Input 248
Software Services 265
Summary 268
Exercises 268
Chapter 13 Cameras 269
A Base Camera Component 270
A First-Person Camera 277
Summary 281
Exercise 281
Chapter 14 Hello, Rendering! 283
Your First Full Rendering Application 284
An Indexed Cube 306
Summary 314
Exercises 314
Chapter 15 Models 315
Motivation 316
Model File Formats 316
The Content Pipeline 317
The Open Asset Import Library 317
What’s in a Model? 318
Meshes 320
Model Materials 321
Asset Loading 323
A Model Rendering Demo 331
Texture Mapping 334
Summary 340
Exercises 340
Chapter 16 Materials 341
Motivation 342
The Effect Class 342
The Technique Class 347
The Pass Class 348
The Variable Class 350
The Material Class 352
A Basic Effect Material 357
A Skybox Material 364
Summary 369
Exercises 370
Chapter 17 Lights 371
Motivation 372
Light Data Types 372
A Diffuse Lighting Material 373
A Diffuse Lighting Demo 377
A Point Light Demo 383
A Spotlight Demo 386
Summary 387
Exercises 387
PART IV: INTERMEDIATE-LEVEL RENDERING TOPICS 389
Chapter 18 Post-Processing 391
Render Targets 392
A Full-Screen Quad Component 396
Color Filtering 401
Gaussian Blurring 410
Bloom 419
Distortion Mapping 425
Summary 433
Exercises 433
Chapter 19 Shadow Mapping 435
Motivation 436
Projective Texture Mapping 436
Shadow Mapping 456
Summary 466
Exercises 467
Chapter 20 Skeletal Animation 469
Hierarchical Transformations 470
Skinning 472
Importing Animated Models 476
Animation Rendering 489
Summary 496
Exercises 496
Chapter 21 Geometry and Tessellation Shaders 497
Motivation: Geometry Shaders 498
Processing Primitives 498
A Point Sprite Shader 499
Primitive IDs 507
Motivation: Tessellation Shaders 508
The Hull Shader Stage 510
The Tessellation Stage 512
The Domain Shader Stage 514
A Basic Tessellation Demo 518
Displacing Tessellated Vertices 520
Dynamic Levels of Detail 524
Summary 527
Exercises 528
Chapter 22 Additional Topics in Modern Rendering 529
Rendering Optimization 530
Deferred Shading 543
Global Illumination 544
Compute Shaders 545
Data-Driven Engine Architecture 550
The End of the Beginning 553
Exercises 553
Index 555