Chapter 15

Picking

In this chapter, we discuss the problem of determining the 3D object (or primitive) the user picked with the mouse cursor (see Figure 15.1). In other words, given the 2D screen coordinates of the mouse cursor, can we determine the 3D object that was projected onto that point? To solve this problem, in some sense, we must work backward; that is to say, we typically transform from 3D space to screen space, but here we transform from screen space back to 3D space. Of course, we already have a slight problem: A 2D screen point does not correspond to a unique 3D point (i.e., more than one 3D point could be projected onto the same 2D projection window point — see Figure 15.2). Thus, there is some ambiguity in determining which object ...

Get Introduction to 3D Game Programming with DirectX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.