Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: eye and clip coordinates

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    eye and clip coordinates

    I'm going through the openGL programming guide, currently in chapter 3 http://www.glprogramming.com/red/chapter03.html about Viewing.

    I just had a few questions about what they speak of as the eye and clip coordinates. I think I get it but I just want to be sure. The eye coordinates are the coordinates obtained by multiplying the original coordinates by the modelview matrix. Correct?

    I'm not certain about what they refer to as 'clip coordinates' though. By my understanding, the eye coordinates are then multiplied by the projection matrix, and the resulting coordinates are clipped to remove any vertices outside the clipping plane. What I'm not sure about is first, is the clipping performed by multiplication of the projection matrix? Or are the vertices clipped before, or after the multiplication? And lastly, which do we call the 'clip coordinates', the coordinates that remain after clipping is finished? Or merely the product of the projection matrix?
    Striving for proficiency...

  2. #2
    Member Newbie
    Join Date
    Apr 2008
    Location
    Germany
    Posts
    38

    Re: eye and clip coordinates

    Quote Originally Posted by mikau
    The eye coordinates are the coordinates obtained by multiplying the original coordinates by the modelview matrix. Correct?
    Yes, that's correct.

    Quote Originally Posted by mikau
    I'm not certain about what they refer to as 'clip coordinates' though. By my understanding, the eye coordinates are then multiplied by the projection matrix, and the resulting coordinates are clipped to remove any vertices outside the clipping plane.
    Clipping planes. There are at least six of them, forming the view frustum. But you may also specify additional ones.

    Quote Originally Posted by mikau
    What I'm not sure about is first, is the clipping performed by multiplication of the projection matrix? Or are the vertices clipped before, or after the multiplication?
    A matrix multiplication cannot do the clipping by itself. The multiplication with the projection matrix will merely transform vertices from eye space to clip space. The actual clipping is performed in a separate step.

    Quote Originally Posted by mikau
    And lastly, which do we call the 'clip coordinates', the coordinates that remain after clipping is finished? Or merely the product of the projection matrix?
    The later one.

    BTW have a look at the OpenGL FAQ (paragraph 9.011 for this topic)

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    Re: eye and clip coordinates

    Thanks for the thorough response.

    So clip coordinates are simply the result of multiplication by the projection matrix. In that case, when, precisely are they clipped? Is it before or after the perspective division step?
    Striving for proficiency...

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: eye and clip coordinates

    On the one hand, I would say they are clipped "during" the perspective division step. This step takes homogeneous clip space coordinates as input and outputs clipped normalized device coordinates. On the other hand, in order to check whether a vertex is inside the canonical view volume, you need to check the non-homogeneous euclidean coordinates. So you could say the actual clipping happens after perspective division

  5. #5
    Senior Member Frequent Contributor
    Join Date
    May 2006
    Posts
    701

    Re: eye and clip coordinates

    Quote Originally Posted by -NiCo-
    On the other hand, in order to check whether a vertex is inside the canonical view volume, you need to check the non-homogeneous euclidean coordinates.
    It doesn't really matter whether you test
    -wc <= [xc, yc, zc] <= wc
    or
    -1 <= [xd, yd, zd] <= 1
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: eye and clip coordinates

    True, but if you want to generate the clipped vertices then you need to intersect the triangle outlines with the faces of the [-1,1]x[-1,1]x[-1,1] volume and find the intersections of the ribs of that volume with the triangle surface. I seriously doubt this is done in homogeneous clip space.

  7. #7
    Senior Member Frequent Contributor
    Join Date
    May 2006
    Posts
    701

    Re: eye and clip coordinates

    And why do you doubt it? It's called clip space for a reason.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  8. #8
    Senior Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: eye and clip coordinates

    Because in normalized device coordinates, calculating the intersection of a triangle edge p1/p2 with the y=1 plane is easy:

    Code :
    t = (1-y1)/(y2-y1)
    if ( t<0 || t>1)
        //no clip
    else
        clipvertex = p1+t(p2-p1)

    try doing that in homogeneous coordinates. There you can't represent a point along the line as p1+t(p2-p1) unless the homogeneous coordinates are equal. Of course you can do this in homogeneous coordinates, you can write out the equations and see that they are more complex.

  9. #9
    Senior Member Frequent Contributor
    Join Date
    May 2006
    Posts
    701

    Re: eye and clip coordinates

    It may well be less complex than the special handling you need for wc == 0 (and wc < 0).
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  10. #10
    Senior Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: eye and clip coordinates

    You're right. I forgot about (wc < 0). My assumption that homogeneous could not be represented by p1+t(p2-p1) was wrong. They can. In that case, the only difference is that t is non-linear in euclidean space, but that's not really an issue if you only need to extract the value of t where it intersects. Clipping to (y=1) then becomes:

    Code :
    p1+t(p2-p1)
     
    where
     
    t = (y1-w1)/((w2-w1)-(y2-y1))

    So there are still special cases where you need to avoid division by zero. But like you said, clipping the vertices with (wc < 0 ) should be done in homogeneous space because they will have positive z values after perspective division.


Page 1 of 2 12 LastLast

Similar Threads

  1. Texture Coordinates and Depth Buffer to obtain world coordinates
    By snkhan42 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 04-27-2018, 11:52 AM
  2. Replies: 4
    Last Post: 06-08-2016, 07:01 PM
  3. Convert windows mouse coordinates to opengl coordinates
    By throwaway in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-05-2013, 06:44 PM
  4. Replies: 2
    Last Post: 06-02-2012, 08:10 AM
  5. clip coordinates
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-27-2006, 09:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean