Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Direct3D Rendering Cookbook
  • Table Of Contents Toc
Direct3D Rendering Cookbook

Direct3D Rendering Cookbook

4.1 (10)
close
close
Direct3D Rendering Cookbook

Direct3D Rendering Cookbook

4.1 (10)

Overview of this book

Table of Contents (19 chapters)
close
close
Direct3D Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Further Reading
2
Index

Rendering a cube and sphere


In this recipe, we will be rendering a simple cube and generating and rendering a sphere and a quad. We will explore the transformation of each of the objects within the 3D world space.

To prepare ourselves for materials and lighting, we will include a normal vector in our vertex structure. The normal vector is a vector that indicates what direction is perpendicular to a tangent on the surface of the object. For each fragment in the pixel shader, we can use the normal vector to determine the angles between the viewer, light source, and surface. This value is necessary so that we can calculate the impact of lighting.

Getting ready

For rendering our cube and sphere, we will first prepare ourselves by following the ensuing steps:

  1. Begin by adding a new Direct3D project to our solution.

  2. Prepare the new project for rendering as per the Rendering primitives recipe in Chapter 2, Rendering with Direct3D, remembering to add the necessary references and to add the build event...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Direct3D Rendering Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon