Perspective Projection view not 2x2

chessman

Newcomer
I created a perspective projection pretty exactly according to Computer Graphics: Principles and Practice in C (2nd Edition) [Hardcover] James D. Foley (Author), Andries van Dam (Author), Steven K. Feiner (Author), John F. Hughes (Author) Chapter 6.

Nper = M * Sper * SHpar * T(-prp) * R * T(-vrp).

I used extents umax = 5, umin = -5; vmax = 5; vmin = -5.
As I understand it, this should project onto a plane of -1,-1 to 1,1. However, my projection has varying extents depending on where I set prp. I can get near to the expected if I set the prp to [0 0 1] but the eyepoint for my system is determined by a frustum that I've already created. I'm just trying to use this projection to detect obscured objects. I'd appreciate any help. If needed, I guess I can post the Matlab code.
 
Apologies for not actually reading anything bar the subject line, but a 3D perspective projection usually uses a homogeneous 4x4 matrix, the flavour of which will depend on the API being used (i.e. IIRC, 3D and OpenGL use different clip coordinate systems) .

Some examples on the web also produce singular matrices - I'd avoid those out of principal :D

Furthermore, if you have a floating-point Depth buffer, try to map near->1 far->0 and rather than the more traditional near=0, far=1.
 
Back
Top