The Microsoft DirectX 9 Programmable Graphics Pipeline
暫譯: 微軟 DirectX 9 可程式化圖形管線
Microsoft Corporation
- 出版商: MicroSoft
- 出版日期: 2003-06-28
- 售價: $2,030
- 貴賓價: 9.5 折 $1,929
- 語言: 英文
- 頁數: 496
- 裝訂: Paperback
- ISBN: 0735616531
- ISBN-13: 9780735616530
已過版
買這商品的人也買了...
-
$1,200$1,176 -
$680$537 -
$2,640$2,508 -
$980$774 -
$880$695 -
$690$587 -
$780$741 -
$650$553 -
$580$458 -
$590$466 -
$620$527 -
$680$537 -
$690$538 -
$720$562 -
$720$569 -
$750$638 -
$560$476 -
$850$723 -
$480$379 -
$750$593 -
$650$553 -
$2,370$2,252 -
$390$332 -
$780$663 -
$580$493
相關主題
商品描述
Summary
The graphics programmer’s essential guide to DirectX 9, straight from the Microsoft DirectX team
The Microsoft DirectX 3D graphics pipeline has undergone a major architectural shift with version 9, making it fully programmable—and this book lets you get in on the action! Discover how you can boost multimedia performance for all types of applications, including animation, texturing, modeling, and rendering, with this next generation of 3D graphics software. Providing a step-by-step tour through the graphics pipeline and its 3D utilities, the book covers fundamental features such as vertex shaders, pixel shaders, effect files, new 3D utilities, including mesh utilities, and DirectX 9 extensions. It also includes coded examples showing you how to use or mix and match blocks within the pipeline for unique graphics needs. Packed with how-to information and documentation straight from the Microsoft DirectX development team, this essential guide delivers everything you need for faster, leaner development—and more powerful results.
Table of Contents
Foreword
xiii
Acknowledgments
xvii
Introduction
xix
PART I PROGRAMMING ASSEMBLY-LANGUAGE SHADERS
1 Vertex Shader Introduction
3
Vertex Processing
4
Vertex Shader Tutorial 1: Transforming Vertices
6
Vertex Shader Tutorial 1a: Adding a Diffuse Color
19
Summary
23
2 Vertex Shader Virtual Machine
25
Virtual Machine Block Diagram
25
Shader Layout
27
Registers
28
Instructions
32
Setup Instructions
33
Arithmetic Instructions
34
Macro-Op Instructions
35
Texture Instructions
36
Flow-Control Instructions
36
Modifiers Extend the Virtual Machine
37
Vertex Shader Version Differences
39
Summary
41
3 Vertex Shader Examples
43
Example 1: Vertex Shader Fog
43
Example 2: Vertex Shader SDK Sample
47
Example 3: Vertex Blend SDK Sample
56
Summary
65
4 Pixel Shader Virtual Machine
67
Pixel Processing
67
Pixel Shader Virtual Machine Block Diagram
72
Shader Layout
74
Registers
75
Input Registers for Versions 1_1 to 1_4
76
Output Register for Versions 1_1 to 1_4
77
Input Registers for Version ps_2_0 and Later
77
Instructions
80
Setup Instructions
82
Arithmetic Instructions
83
Macro-Op Instructions
84
Texture Instructions
85
Flow-Control Instructions
87
Instruction Set Summary
89
Modifiers Extend the Virtual Machine
89
Modifiers for Versions 1_1 to 1_4
90
Modifiers for ps_2_0 and Later
92
Pixel Shader Version Differences
92
Summary
93
5 Pixel Shader Examples
95
Example 1: 2-D Image Processing
95
Example 2: Multilayered Textures
101
PART II PROGRAMMING HLSL SHADERS
6 HLSL Introduction
109
Tutorial 1: Start with a Vertex Shader: Hello World
110
Add a Diffuse Color
113
Tutorial 2: Add a Pixel Shader
115
Complementing
118
Darkening
118
Masking the Red Out
119
Displaying Red Only
119
Tutorial 3: Add a Procedural Texture
120
Building the Tutorials
122
Creating Resources
123
Rendering
129
Summary
130
7 The Language
131
Data Types
131
Scalar Types
131
Variable Declaration
132
Type Modifiers
132
Storage Class Modifiers
134
Semantics
135
Annotations
135
Vector Types
135
Matrix Types
138
Constructors
142
Casting
143
Integer Math
144
Complex Data Types
144
Expressions and Statements
149
Statements
155
Functions
160
Function Declaration
160
Function Body
167
Intrinsic Functions
168
Summary
169
8 HLSL Examples
171
Glow Example
171
Apply a Texture
173
Add the Glow
183
Sparkle Example
192
Vertex Shader
195
Texture Shader
198
Pixel Shader
199
Diffuse Only
201
Diffuse and Gloss
201
Diffuse, Gloss, and Sparkle
201
Vertex and Pixel Shader Creation
202
Procedural Texture Creation
204
Environment Map Creation
205
Mesh Creation
206
Render
210
HLSL Experimentation in EffectEdit
211
Summary
212
PART III PROGRAMMING EFFECTS
9 Effect Introduction
215
Effects and the 3-D Pipeline
215
An Effect with an Assembly-Language Vertex Shader
217
Effect Global Variables
218
Effect State
219
HLSL Vertex Shader
222
Characteristics of Effects
225
Save and Restore State
225
Use Multiple Techniques and Passes
227
Share Parameters
229
Use Semantics to Find Parameters
230
Use Handles to Get and Set Parameters
230
Add Parameter Information with Annotations
231
Building an Effect
232
Create an Effect
232
Validate an Effect
234
Render an Effect
234
Summary
236
10 Assembly-Language Effect Examples
237
Example 1: Asm Vertex Shader with Lighting
237
Example 2: Asm Vertex Shader and Pixel Shader with Texturing
243
Example 3: Asm Vertex Shader Environment Map
249
11 HLSL Effect Examples
259
Example 1: Vertex and Pixel Shader with Per-Pixel Lighting
259
Example 2: Multiple-Pass Rendering with Alpha Blending
265
EffectEdit: Interactive Effect Development
274
The Code Pane
274
The Render Pane
275
The Rendering Options Pane
275
The Compile Results Pane
275
Getting an Effect to Run in EffectEdit
276
Example 3: Hemispheric Lighting
278
PART IV APPENDIXES
A Vertex Processing
287
Transformations
287
Affine Transform
289
Left-to-Right Order
290
World Transform
291
View Transform
292
Projection Transform
294
Vertex Fog
297
Lights and Materials
299
Ambient Light
300
Diffuse Light
300
Specular Light
301
Emissive Light
302
Light Attenuation
302
Spotlight Cone
303
B Asm Shader Instructions
305
Instructions
305
C HLSL Reference
347
1: Data Types
347
1.1 Intrinsic Types
347
1.2 User-Defined Types
348
1.3 Type Casts
349
2: Operators
351
3: User-Defined Functions
353
3.1 Vertex Shader Semantics
355
3.2 Pixel Shader Semantics
356
3.3 Procedural Texture Shader Semantics
357
4: Intrinsic Functions
357
5: Pixel Shader 1_x Considerations
386
5.1 ps_1_1, ps_1_2, and ps_1_3
387
5.2 ps_1_4
387
5.3 Modifiers
388
5.4 Texture Instructions
391
6: Keywords
397
7: Directives
398
8: Lexical Conventions
398
8.1 White Space
398
8.2 Floating-Point Numbers
399
8.3 Integer Numbers
399
8.4 Characters
400
8.5 Identifiers
401
8.6 Strings
400
9: Grammar
400
9.1 Program
400
9.2 Declarations
400
9.3 Usages
401
9.4 Types
401
9.5 Structures
402
9.6 Annotations
403
9.7 Variables
403
9.8 Initializers
403
9.9 Functions
403
9.10 Techniques
404
9.11 Statements
405
9.12 Expressions
405
9.13 Tokens
407
D Effect Reference
409
1: Effect Format
409
1.1 Variables
409
1.2 Techniques
411
1.3 Passes
411
1.4 Expressions
411
1.5 Annotations
413
1.6 Cloning and Sharing
414
1.7 Handles
415
1.8 IDs and Semantics
416
1.9 Usages
417
1.10 Literals
417
1.11 Validation
418
2: Effect States
418
2.1 Light States
419
2.2 Material States
420
2.3 Render States: Vertex Pipeline vs. Pixel Pipeline
421
2.4 Sampler States
426
2.5 Sampler Stage States
426
2.6 Shader States
428
2.7 Shader Constant States
429
2.8 Texture States
431
2.9 Texture Stage States
431
2.10 Transform States
433
Summary
433
INDEX
435
商品描述(中文翻譯)
摘要
圖形程式設計師的 DirectX 9 必備指南,直接來自 Microsoft DirectX 團隊
Microsoft DirectX 3D 圖形管線在版本 9 中經歷了重大的架構轉變,使其完全可程式化——而這本書讓你能夠參與其中!發現如何利用這一代 3D 圖形軟體提升各類應用程式的多媒體效能,包括動畫、紋理、建模和渲染。本書提供了圖形管線及其 3D 工具的逐步導覽,涵蓋了基本功能,如頂點著色器、像素著色器、效果檔案、新的 3D 工具(包括網格工具)以及 DirectX 9 擴展。它還包括編碼範例,展示如何在管線中使用或混合不同的區塊以滿足獨特的圖形需求。這本必備指南充滿了來自 Microsoft DirectX 開發團隊的實用資訊和文檔,提供了你所需的一切,以實現更快、更精簡的開發和更強大的結果。
目錄
前言 xiii
致謝 xvii
導言 xix
第一部分 程式設計組合語言著色器
1 頂點著色器介紹 3
頂點處理 4
頂點著色器教程 1:變換頂點 6
頂點著色器教程 1a:添加漫反射顏色 19
總結 23
2 頂點著色器虛擬機 25
虛擬機區塊圖 25
著色器佈局 27
寄存器 28
指令 32
設定指令 33
算術指令 34
巨集操作指令 35
紋理指令 36
流控制指令 36
修飾符擴展虛擬機 37
頂點著色器版本差異 39
總結 41
3 頂點著色器範例 43
範例 1:頂點著色器霧 43
範例 2:頂點著色器 SDK 範例 47
範例 3:頂點混合 SDK 範例 56
總結 65
4 像素著色器虛擬機 67
像素處理 67
像素著色器虛擬機區塊圖 72
著色器佈局 74
寄存器 75
版本 1_1 到 1_4 的輸入寄存器 76
版本 1_1 到 1_4 的輸出寄存器 77
版本 ps_2_0 及以後的輸入寄存器 77
指令 80
設定指令 82
算術指令 83
巨集操作指令 84
紋理指令 85
流控制指令 87
指令集總結 89
修飾符擴展虛擬機 89
版本 1_1 到 1_4 的修飾符 90
ps_2_0 及以後的修飾符 92
像素著色器版本差異 92
總結 93
5 像素著色器範例 95
範例 1:2-D 圖像處理 95
範例 2:多層紋理 101
第二部分 程式設計 HLSL 著色器