Training
Certifications
Books
Special Offers
Community




 
Microsoft® DirectX® 9 Programmable Graphics Pipeline
Author Kris Gray
Pages 496
Disk 1 Companion CD(s)
Level All Levels
Published 06/18/2003
ISBN 9780735616530
Price $49.99
To see this book's discounted price, select a reseller below.
 

More Information

About the Book
Table of Contents
Sample Chapter
Index
Related Series
About the Author

Support: Book & CD

Rate this book
Barnes Noble Amazon Quantum Books

 

Table of Contents


    Forewordxiii
    Acknowledgmentsxvii
    Introductionxix
PART I  PROGRAMMING ASSEMBLY-LANGUAGE SHADERS 
1  Vertex Shader Introduction3
    Vertex Processing 4
    Vertex Shader Tutorial 1: Transforming Vertices6
    Vertex Shader Tutorial 1a: Adding a Diffuse Color 19
    Summary23
2  Vertex Shader Virtual Machine 25
    Virtual Machine Block Diagram 25
    Shader Layout 27
    Registers 28
    Instructions32
        Setup Instructions 33
        Arithmetic Instructions 34
        Macro-Op Instructions 35
        Texture Instructions36
        Flow-Control Instructions 36
    Modifiers Extend the Virtual Machine37
    Vertex Shader Version Differences39
    Summary 41
3  Vertex Shader Examples43
    Example 1: Vertex Shader Fog 43
    Example 2: Vertex Shader SDK Sample 47
    Example 3: Vertex Blend SDK Sample 56
    Summary65
4  Pixel Shader Virtual Machine 67
    Pixel Processing67
    Pixel Shader Virtual Machine Block Diagram 72
    Shader Layout 74
    Registers75
        Input Registers for Versions 1_1 to 1_476
        Output Register for Versions 1_1 to 1_4 77
        Input Registers for Version ps_2_0 and Later 77
    Instructions80
        Setup Instructions 82
        Arithmetic Instructions 83
        Macro-Op Instructions 84
        Texture Instructions 85
        Flow-Control Instructions87
        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 Differences92
    Summary93
5  Pixel Shader Examples 95
    Example 1: 2-D Image Processing95
    Example 2: Multilayered Textures 101
PART II  PROGRAMMING HLSL SHADERS 
6  HLSL Introduction 109
    Tutorial 1: Start with a Vertex Shader: Hello World110
        Add a Diffuse Color113
    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 Texture120
    Building the Tutorials122
        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 Modifiers134
        Semantics 135
        Annotations135
        Vector Types135
        Matrix Types 138
        Constructors142
        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 Glow183
    Sparkle Example192
        Vertex Shader195
        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 Creation204
        Environment Map Creation 205
        Mesh Creation 206
        Render210
    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 Variables218
        Effect State 219
    HLSL Vertex Shader 222
    Characteristics of Effects 225
        Save and Restore State225
        Use Multiple Techniques and Passes 227
        Share Parameters229
        Use Semantics to Find Parameters 230
        Use Handles to Get and Set Parameters 230
        Add Parameter Information with Annotations231
    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 Examples259
    Example 1: Vertex and Pixel Shader with Per-Pixel Lighting 259
    Example 2: Multiple-Pass Rendering with Alpha Blending 265
    EffectEdit: Interactive Effect Development274
        The Code Pane274
        The Render Pane 275
        The Rendering Options Pane 275
        The Compile Results Pane275
        Getting an Effect to Run in EffectEdit 276
    Example 3: Hemispheric Lighting278
PART IV  APPENDIXES 
A  Vertex Processing287
    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 Light300
    Diffuse Light 300
    Specular Light301
    Emissive Light 302
    Light Attenuation 302
    Spotlight Cone303
B  Asm Shader Instructions 305
    Instructions 305
C  HLSL Reference 347
    1: Data Types347
        1.1 Intrinsic Types347
        1.2 User-Defined Types348
        1.3 Type Casts349
    2: Operators351
    3: User-Defined Functions353
        3.1 Vertex Shader Semantics355
        3.2 Pixel Shader Semantics356
        3.3 Procedural Texture Shader Semantics357
    4: Intrinsic Functions357
    5: Pixel Shader 1_x Considerations386
        5.1 ps_1_1, ps_1_2, and ps_1_3387
        5.2 ps_1_4387
        5.3 Modifiers388
        5.4 Texture Instructions391
    6: Keywords397
    7: Directives398
    8: Lexical Conventions398
        8.1 White Space398
        8.2 Floating-Point Numbers399
        8.3 Integer Numbers399
        8.4 Characters400
        8.5 Identifiers401
        8.6 Strings400
    9: Grammar400
        9.1 Program400
        9.2 Declarations400
        9.3 Usages401
        9.4 Types401
        9.5 Structures402
        9.6 Annotations403
        9.7 Variables403
        9.8 Initializers403
        9.9 Functions403
        9.10 Techniques404
        9.11 Statements405
        9.12 Expressions405
        9.13 Tokens407
D  Effect Reference 409
    1: Effect Format 409
        1.1 Variables 409
        1.2 Techniques411
        1.3 Passes411
        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 States419
        2.2 Material States 420
        2.3 Render States: Vertex Pipeline vs. Pixel Pipeline421
        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 States431
        2.10 Transform States433
        Summary 433
INDEX435



Last Updated: May 29, 2003
Top of Page