3D models
asset loading
loading model materials, 328-331
content pipeline, 317
Open Asset Import Library, 317-318
AABBs (axis-aligned bounding boxes), 531
Add Effect dialog box (FX Composer), 60
adding vectors, 25
border address mode, 88
mirror address mode, 87
wrap address mode, 86
AdjustWindowRect() function, 202
AmbientColor shader constant, 94-95
incrementing/decrementing intensity of, 381-382
pixel shader, 95
AmbientColor shader constant, 94-95
animated models
bind pose, retrieving, 491
skeletal animation, rendering, 489-495
AnimationPlayer class, 489-491
anisotropic filtering, 83
APIs
Direct3D, 9
DirectX, 7
Open Asset Import Library, 317-318
OpenGL, 9
applications
FX Composer
Assets panel, 49
effects, 49
materials, 49
Textures panel, 52
input layout, creating, 293-297
rotating the triangle, 305-306
Visual Studio Graphics Debugger, 53-55
ApplyRotation() method, 276
loading model materials, 328-331
Assets panel (FX Composer), 49
audience for this book, 2
authoring file formats, 316
AutoDesk Maya, 52
automatic binding, 105
backface culling, 15
basic effect materials, 357-364
BasicEffect shader, 342
bind pose, 491
bitmaps, 18
blend operation options, 159
BlendState objects, 159
BlinnPhongIntrinsics.fx, 113-114
BlinnPhongIntrinsics.fx, 113-114
blurring, Gaussian blurring, 410-418
border address mode, 88
brightness, Lambert’s cosine law, 97
BVHs (bounding volume hierarchies), 530
calculating
linear interpolation, 489
vector length, 26
CenterWindow() method, 203
changing coordinate systems, 34-35
checking for multisampling support, 208-210
classes
AnimationPlayer class, 489-491
DiffuseLightingDemo class, 377-378
DiffuseLightingMaterial class, 375-377
FullScreenRenderTarget class, 392-395
Game class, header file, 200-201
GameClock, 197
ProxyModel class, 378
ServiceContainer class, 266-267
blend operation options, 159
BlendState objects, 159
common settings, 159
multiplicative blending, 159-161
TransparencyMapping.fx, 161-165
color filtering
sepia filter, 407
color inverse filters, 405-406
ColorFilteringGame::Draw() method, 404
ColorFilteringGame::UpdateColorFilterMaterial() method, 404
column-major order, 30
comments, HLSL, 77
common color blending settings, 159
companion website for this book, 4
comparing Blinn-Phong and Phong models, 114
threads, 545
constant buffers, 62
constant hull shaders, 511-512
constants, AmbientColor shader constant, 94-95
content pipeline, 317
Open Asset Import Library, 317-318
control point patch lists, 16
control points, 510
coordinate systems, changing, 34-35
CPU (central processing unit), 9
creating
game components, 234
constant buffers, 62
effect files, 62
output, 67
material for BasicEffect shader, 357-361
rendering engine project, 187
specialized Game class, 228-230
output, 81
cross product, 27
cube maps. See texture cubes
culling, disabling, 63
cylindrical billboarding, 499-502
D3DX (Direct3D Extension) library, 46
data-driven engine architecture, 550-552
data structures, rewriting HelloShaders effect for C-style structs, 68-70
data types, light data types, 372-373
DDS (DirectDraw Surface), 46
debugging
graphics, 55
decrementing ambient light intensity, 381-382
demos
spotlights, 386
depth testing, 20
deserialization, 317
device input
Lambert’s cosine law, 97
vertex shader, 102
DiffuseLightingDemo class, 377-378
DiffuseLightingMaterial class, 375-377
initializing
associating views to output-merger stage, 218
checking for multisampling support, 208-210
creating a depth-stencil view, 215-218
creating a render target view, 214-215
creating the device context, 206-208
creating the swap chain, 210-214
setting the viewport, 219
Direct3D Graphics Pipeline
geometry shader stage, 18
index buffers, 11
pixel shader stage, 19
tessellation stage, 512
vertex shader stage, 16
DirectInput library
intensity, 105
directory structure, rendering engine project, 186
DirectX, 7
DirectX 11, 8
DirectX 8, 8
DirectX 9, 8
OpenGL, 9
texture coordinates, 74
DirectX Texture Tool, 143
calling conventions, 37
initialization functions, 37
loading and storing, 36
operators, 38
DirectXTK (DirectX Tool Kit), 46
disabling culling, 63
displacing tessellated vertices, 520-523
full-screen distortion shader, 425-426
masking distortion shader, 427-431
DLLs, Open Asset Import Library, 317-318
domain-shader stage (Direct3D Graphics Pipeline), 514-518
draw order, effect on alpha-blended objects, 166-167
drawable game components, 239-240
dynamic environment mapping, 153-154
dynamic tessellation effect, 524-527
effects, 49
ambient lighting effect, 92-94
pixel shaders, 112
diffuse lighting
diffuse lighting effect
vertex shader, 102
displacement mapping effect, 179-181
dynamic tessellation effect, 524-527
environment mapping
vertex shader, 152
environment mapping effect
output, 153
output, 157
pixel shader, 157
preamble, 157
vertex shader, 157
multiple point lights effect, 132-138
output, 138
normal mapping effect, 173-177
preamble, 176
preamble, 109
PointLight.fx
preamble, 120
skybox effect
pixel shader, 147
preamble, 147
vertex shader, 147
texture mapping effect, creating, 75-81
transparency mapping effect, 165-166
Effects 11 library, 46, 288-293
dynamic environment mapping, 153-154
EnvironmentMapping.fx, 149-151
feature levels (Direct3D), 207-208
file formats
texture file formats, 46
final project settings, rendering engine project, 192-193
first-person camera, implementing, 277-281
output, 157
pixel shader, 157
preamble, 157
forward rendering, 543
full-screen distortion shaders, 425-426
FullScreenRenderTarget class, 392-395
functions
AdjustWindowRect(), 202
lit(), 113
reflect(), 152
WinMain(), 194
WinMain(), updating for RenderingGame class, 230-232
Add Effect dialog box, 60
Assets panel, 49
effects, 49
materials, 49
Select HLSL FX Template dialog box, 60
Textures panel, 52
Game class
ServiceContainer member, adding, 267-268
specialized Game class, creating, 228-230
updating for Direct3D initialization, 220-228
game components
creating, 234
drawable game components, 239-240
Game class support for, 240-248
game engine file formats, 316
initialization, 199
time-related information, 196-199
Game project
final project settings, 192-193
Program.cpp file, adding, 193-194
GameClock class, 197
Game::Initialization() method, 196
Game::InitializeWindow() method, 201-202
gaming consoles
XBox, 8
XBox 360, 8
sample offsets and weights, initializing, 415-416
general-purpose Game class, updating for Direct3D initialization, 220-228
generic color filters, 408-410
geometry shader stage (Direct3D Graphics Pipeline), 18
geometry shaders, 498
graphics pipeline, hull-shader stage, 510-512
primitive IDs, 507
processing primitives, 498-499
GPU (graphics processing unit), 1, 9
GPU PerfStudio 2, 55
GPU skinning, 472
graphics, debugging, 55
graphics cards, 8
header file, Game class, 200-201
“Hello, Rendering” application, 284-306
input layout, creating, 293-297
rotating the triangle, 305-306
HelloShaders effect
constant buffers, 62
effect files, 62
output, 67
pixel shader, 65
rewriting for C-style structs, 68-70
hierarchical transformations, 470
DirectX 11, 8
DirectX 8, 8
DirectX 9, 8
HLSL, 8
OpenGL, 9
programmable shaders, 8
HLSL (High-Level Shading Language), 8
comments, 77
preprocessor commands, 77
texture mapping
homogeneous coordinates, 31
hull-shader stage (graphics pipeline), 510-512
IDE (integrated development environment), 44
identity matrix, 31
implementing a first-person camera, 277-281
importing animated models, 476-489
include directories, rendering engine project, 189-190
incrementing ambient light intensity, 381-382
index buffers, 11
indirect lighting, 544
initializing
Direct3D
associating views to output-merger stage, 218
checking for multisampling support, 208-210
creating a render target view, 214-215
creating the device context, 206-208
creating the swap chain, 210-214
setting the viewport, 219
game loop, 199
Gaussian blurring sample offsets and weights, 415-416
input layout, creating for “Hello Rendering” application, 293-297
input-assembler stage (Direct3D Graphics Pipeline), 10-16
index buffers, 11
prerequisites, 4
intensity
of ambient lights, incrementing/decrementing, 381-382
of directional lights, changing, 105
interchange file formats, 316
interpolation, linear interpolation, 82-83
Lambert’s cosine law, 97
left-handed coordinate systems, 24-25
Library project, final project settings, 192-193
lighting, SH lighting, 544
lighting models
Phong reflection model, 105-111
linear interpolation, calculating, 489
linking libraries, rendering engine project, 190-191
lit() function, 113
loading
vectors, 36
LODs (levels of detail), 17-18, 524
anisotropic filtering, 83
point filtering, 82
manipulating point lights, 385-386
manual binding, 105
masking distortion shaders, 427-431
basic effect materials, 357-364
diffuse lighting material, 373-377
skybox material, creating, 364-366
column-major order, 30
identity matrix, 31
multiplication, 28
row-major order, 30
subtracting, 28
transposing, 29
methods
ApplyRotation(), 276
CenterWindow(), 203
ColorFilteringGame::Draw(), 404
ColorFilteringGame::UpdateColorFilterMaterial(), 404
Game::Initialization(), 196
Game::InitializeWindow(), 201-202
Reset() method, 275
Sample(), 79
SetBlurAmount(), 415
SetMaterial(), 397
UpdateGameTime(), 196
UpdateProjectionMatrix(), 276
UpdateViewMatrix(), 276
Microsoft Visual Studio. See Visual Studio
minification, 83
mirror address mode, 87
model file formats, 316
MRTs (multiple render targets), 543
MSAA (Multisample Anti-Aliasing), 208
MultiplePointLights.fx, 132-138
multiple point lights effect
output, 138
techniques, 137
MultiplePointLights.fx, 132-138
preamble, 136
multiplicative blending, 159-161
multiplying matrices, 28
normals, 102
Nsight Visual Studio Edition, 55
nvDXT command-line tool, 142
NVIDIA
Add Effect dialog box, 60
Select HLSL FX Template dialog box, 60
Nsight Visual Studio Edition, 55
OBBs (oriented bounding boxes), 531
object sorting, 532
object space, 34
SSAO, 544
occlusion culling, 532
octrees, 531
Open Asset Import Library, 317-318
animated models, importing, 476-489
loading model materials, 328-331
OpenGL, 9
optimizing rendering speed
object sorting, 532
occlusion culling, 532
Orbit camera (FX Composer), 52
output
ambient lighting effect, 95-96
diffuse lighting effect, 103-105
displacement mapping effect, 180-181
environment mapping effect, 153
fog effect, 157
HelloShaders effect, 67
multiple point lights effect, 138
normal mapping effect, 177
Phong effect, 111
Spotlight.fx, 129
transparency mapping effect, 165-166
output-merger stage (Direct3D Graphics Pipeline), 19-20
patches, 510
percentage closer filtering, 460-465
peter panning, 466
Phong reflection model, 105-111
output, 111
preamble, 109
PIX, 52
pixel shader stage (Direct3D Graphics Pipeline), 19
pixel shaders
ambient lighting pixel shader, 95
Blinn-Phong effect, 112
diffuse lighting pixel shader, 102-103
environment mapping effect, 152
fog effect, 157
multiple point lights effect, 136-137
normal mapping effect, 177
point light pixel shader, 120
skybox effect, 147
spotlight pixel shader, 129
pixels
blurring images, 411
minification, 83
point filtering, 82
point lists, 13
preamble, 120
portal rendering, 532
post-processing, 391
color filtering
sepia filter, 407
full-screen distortion shader, 425-426
masking distortion shader, 427-431
full-screen quad component, 396-401
shadow mapping, 435
preamble
diffuse lighting effect, 101-102
displacement mapping effect, 180
environment mapping effect, 151-152
fog effect, 157
MultiplePointLights.fx, 136
normal mapping effect, 176
Phong effect, 109
PointLight.fx, 120
skybox effect, 147
Spotlight.fx, 129
preprocessor commands, HLSL, 77
primitive IDs, 507
adjacency data, 15
processors, CPU, 9
Program.cpp file, adding to Game project, 193-194
programmable shaders, 8
project build order, rendering engine project, 188-189
project setup (rendering engine)
directory structure, 186
projection space, 35
projective texture mapping, 436-456
projective texture coordinates, 438-439
projective texture-mapping shader, 439-442
ProxyModel class, 378
PVS (potentially visible set) rendering, 532
quadtrees, 531
quaternions, 486
rasterizer stage (Direct3D Graphics Pipeline), 18-19
reflect() function, 152
reflection
Phong reflection model, 105-111
Render panel (FX Composer), 51-52
render target views, 396
rendering, 1
forward rendering, 543
optimizing
object sorting, 532
occlusion culling, 532
shaders, 2
rendering engine
data driven engine architecture, 550-552
final project settings, 192-193
Game class, header file, 200-201
initialization, 199
time-related information, 196-199
Game project, linking libraries, 190-191
project creation, 187
project setup, directory structure, 186
RenderMonkey, 48
Reset() method, 275
retrieving skinned model’s bind pose, 491-492
rewriting HelloShaders effect for C-style structs, 68-70
rigging, 470
right-handed coordinate systems, 24-25
rotating directional lights, 382-383
rotation matrix, 33
row-major order, 30
RTTI (Runtime Type Information), customizing, 237-239
Sample() method, 79
SamplerState filtering options (TextureMapping.fx), 85
sampling
Gaussian blurring sample offsets and weights, initializing, 415-416
percentage closer filtering, 460-465
texture cubes, 144
scalars, 24
scaling transformations, 31-32
scenes, post-processing, 391
full-screen quad component, 396-401
Select HLSL FX Template dialog box (FX Composer), 60
semantics, 62
sepia filters, 407
serialization, 317
ServiceContainer class, 266-267
SetBlurAmount() method, 415
SetMaterial() method, 397
SH (spherical harmonic) lighting, 544
authoring tools, 48
BasicEffect shader, 342
threads, 545
constants, 62
AmbientColor shader constant, 94-95
full-screen distortion shader, 425-426
Gaussian blurring shader, 411-413
geometry shaders, 18
primitive IDs, 507
processing primitives, 498
HelloShaders effect
constant buffers, 62
effect files, 62
output, 67
rewriting for C-style structs, 68-70
masking distortion shader, 427-431
pixel shaders, 19
ambient lighting pixel shader, 95
Blinn-Phong effect, 112
diffuse lighting pixel shader, 102-103
environment mapping effect, 152
fog effect, 157
multiple point lights effect, 136-137
normal mapping effect, 177
point light pixel shader, 120
skybox effect, 147
spotlight pixel shader, 129
programmable shaders, 8
projective texture-mapping shader, 439-442
shadow-mapping shader, 456-459
vertex shader
diffuse lighting vertex shader, 102
displacement mapping effect, 180
environment mapping effect, 152
fog effect, 157
multiple point lights effect, 136-137
normal mapping effect, 177
Phong effect, 109
point light vertex shader, 120
spotlight vertex shader, 129
vertex shader stage (Direct3D Graphics Pipeline), 16
vertex shaders, skybox effect, 147
shadow acne, 456
shadow mapping, 435-436, 456-466
depth maps
percentage closer filtering, 460-465
projective texture mapping, 436-456
projective texture coordinates, 438-439
projective texture-mapping shader, 439-442
slope-scaled depth biasing, 465-466
shadow-mapping shaders, 456-459
Silicon Graphics Inc., 9
skeletal animation, 469
animated models, importing, 476-489
bind pose, retrieving, 491
hierarchical transformations, 470
skybox effect, output, 147-148
slope-scaled depth biasing, 456, 465-466
ServiceContainer class, 266-267
specialized Game class, creating, 228-230
Phong reflection model, 105-111
spherical billboarding, 499-502
Spotlight.fx
output, 129
preamble, 129
demo, 386
SSAO (screen-space ambient occlusion), 544
stencil testing, 20
storing vectors, 36
subtracting
matrices, 28
vectors, 25
surface normals, 102
techniques
multiple point lights effect, 137
tessellation
displacing tessellated vertices, 520-523
dynamic levels of detail, 524-527
tessellation stages (Direct3D Graphics Pipeline), 16-18, 512
texels, minification, 83
text file formats, 316
border address mode, 88
mirror address mode, 87
wrap address mode, 86
sampling, 144
texture file formats, 46
magnification
anisotropic filtering, 83
point filtering, 82
minification, 83
SamplerState filtering options (TextureMapping.fx), 85
texture mapping, 74-75, 334-339
DirectX texture coordinates, 74
output, 81
projective texture mapping, 436-456
TextureMapping.fx, SamplerState filtering options, 85
TextureModelDemo class, 335-339
Textures panel (FX Composer), 52
TGA (Targa), 46
threads, 545
time-related information
transformations
hierarchical transformations, 470
homogeneous coordinates, 31
quaternions, 486
rotating, 33
translating transformations, 32-33
transparency mapping effect, 165-166
TransparencyMapping.fx, 161-165
transposing matrices, 29
triangle, rendering for “Hello, Rendering” application, 297-304
triangle list, 14
UAVs (unordered access views), 547
UDK (Unreal Development Kit), 550
Unity game engine, 550
UpdateGameTime() method, 196
UpdateProjectionMatrix() method, 276
UpdateViewMatrix() method, 276
updating WinMain() function for RenderingGame class, 230-232
adding and subtracting, 25
cross product, 27
DirectXMath, 36
length of, 26
vertex shader stage (Direct3D Graphics Pipeline), 16
diffuse lighting vertex shader, 102
displacement mapping effect, 180
environment mapping effect, 152
fog effect, 157
multiple point lights effect, 136-137
normal mapping effect, 177
Phong effect, 109
point light vertex shader, 120
skybox effect, 147
spotlight vertex shader, 129
vertices
displacing, 178
displacing tessellated vertices, 520-523
view space, 34
viewports, 219
views
associating to output-merger stage, 218
render target views, 396
UAVs, 547
Visual Studio Graphics Debugger, 53-55
websites, companion website for this book, 4
WIC (Windows Imaging Components), 46
windows, initializing, 199-201
Windows 7, 8
Windows Vista, 8
WinMain() function, 194
updating for RenderingGame class, 230-232
world space, 34
wrap address mode, 86
XBox, 8
XBox 360, 8
z-culling, 532
18.190.239.166