Changes between Version 8 and Version 9 of MousePicking

Show
Ignore:
Author:
bhook (IP: 64.207.62.170)
Timestamp:
05/18/06 14:18:58 (13 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MousePicking

    v8 v9  
    8686== The Inverse View Transformation == 
    8787 
     88To go from mouse coordinate to world coordinates we have to do the exact opposite of the view transformation: 
     89 
     90{{{ 
     91#!latex-math-hook 
     92\begin{quote} 
     93Viewport \to NDC \to Clip \to View \to World/Model 
     94\end{quote} 
     95}}} 
     96 
     97That's a lot of steps, and it's easy to screw up, and if you screw up just a little that's enough to blow everything apart. 
     98 
     99=== Viewport to NDC to Clip === 
     100 
     101The first step is to transform the viewport coordinates into clip coordinates.  The viewport transformation takes a normalized device coordinate and transforms it into a viewport coordinate: 
     102 
     103{{{ 
     104#!latex-math-hook 
     105\begin{eqnarray*} 
     106{\boldsymbol V}{\boldsymbol n}&=&{\boldsymbol v}&=&  
     107\begin{pmatrix} 
     108\frac{ {\boldsymbol n}_x + 1 }{2}w\\ 
     109\frac{ 1-{\boldsymbol n}_y}{2}h\\ 
     110\frac{ {\boldsymbol n}_z + 1 }{ 2 } 
     111\end{pmatrix} \\ 
     112\text{where}\\ 
     113\boldsymbol{V}&=&\text{viewport transformation matrix}\\ 
     114\boldsymbol{n}&=&\text{normalized device coordinate}\\ 
     115\boldsymbol{v}&=&\text{point in viewport/window space}\\ 
     116\end{eqnarray*} 
     117}}}