Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Direct3D Rendering Cookbook

You're reading from  Direct3D Rendering Cookbook

Product type Book
Published in Jan 2014
Publisher
ISBN-13 9781849697101
Pages 430 pages
Edition 1st Edition
Languages

Table of Contents (19) Chapters

Direct3D Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with Direct3D 2. Rendering with Direct3D 3. Rendering Meshes 4. Animating Meshes with Vertex Skinning 5. Applying Hardware Tessellation 6. Adding Surface Detail with Normal and Displacement Mapping 7. Performing Image Processing Techniques 8. Incorporating Physics and Simulations 9. Rendering on Multiple Threads and Deferred Contexts 10. Implementing Deferred Rendering 11. Integrating Direct3D with XAML and Windows 8.1 Further Reading
Index

Preparing the vertex and constant buffers for materials and lighting


In this recipe, we will update the vertex and pixel shader structures and our constant buffers to provide additional information that our vertex shader and pixel shader need to be able to perform material and lighting operations.

After extending our per object constant buffer to support the transformation of the normal vector and position into world space, we will also add a per frame constant buffer that will contain our camera position and light configuration. How to create C# structures that reflect the HLSL constant buffers is also covered.

Our vertex shader input structure will be changed to accept the normal vector and UV coordinates from the previous recipe, and then update the pixel shader input structure to receive the normal vector transformed to world space in addition to the world space position and the UV coordinates.

As our shaders are becoming more complex, we will split them into multiple files; to support...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}