Home > Store

Real-Time 3D Rendering with DirectX and HLSL: A Practical Guide to Graphics Programming

Register your product to gain access to bonus material or receive a coupon.

Real-Time 3D Rendering with DirectX and HLSL: A Practical Guide to Graphics Programming

eBook (Watermarked)

  • Your Price: $38.39
  • List Price: $47.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® 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.


  • Copyright 2014
  • Dimensions: 7" x 9"
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-357017-7
  • ISBN-13: 978-0-13-357017-5

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

Sample Content

Table of Contents

Introduction     1
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

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

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

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


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020