Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Oblique near clipping on perspective matrix

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Feb 2012

    Oblique near clipping on perspective matrix

    Hello all,

    I try to use the sample from Eric Lengyel without success,

    I think my problem is related to the clip plane, since my plane is from world coordinate, it say it need to be in camera eye coord,
    Do I need transform my plane (world space) before using it?

    The perspective matrix is build using glm:erspective, my matrix are basically glm::mat4...

    Code :
        matrix4 oblique = projection;
        vector4 plane(normal, distance);
        vector4 q;
        q.x = (sign(plane.x) + projection[0][2]) / projection[0][0];
        q.y = (sign(plane.y) + projection[1][2]) / projection[1][1];
        q.z = -1.0f;
        q.w = (1.0f + projection[2][2]) / projection[2][3];
        vector4 c = plane * (2.0f / glm::dot(plane, q));
        oblique[0][2] = c.x;
        oblique[1][2] = c.y;
        oblique[2][2] = c.z + 1.0f;
        oblique[3][2] = c.w;

    Here the shot using the projection without the oblique. The second shot show the issue I try to resolve with oblique near clip plane.

    If I am using this code, I am jumping out of the map, I just see the sky
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	oblique0.jpg 
Views:	495 
Size:	15.8 KB 
ID:	1072   Click image for larger version. 

Name:	oblique1.jpg 
Views:	1584 
Size:	13.4 KB 
ID:	1073  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts