Hi Benedikt, I don't have time to look at this right now, but off the top of my head the sign difference that you noticed may be because I grabbed this from a reverse projection that I did (the projection was bounced off some mirrors to a back projection which in turn was viewed by looking into another mirror). So if everything was flipped when you tried this, that was probably the reason why.
-K On Wed, 6 Apr 2011, benedikt naessens wrote:
Keith Parkins wrote:After looking at this again, I am unclear as to whether you have built the projection matrix from the intrinsic parameters. I was assuming that you had made it by hand. To do that you would do something like this: //-----------------------------------------------------------------------------// // The _intrinsic variable holds the five values for the intrinsic // matrix. The intrinsic * our pixel transform to get the projections // matrix. The intrinsic values (itr[]) are given as five doubles // such that: // // | itr[0] itr[1] itr[2] | // | 0 itr[3] itr[4] | // | 0 0 0 | // // | alpha_u gamma u_0 | // | 0 alpha_v v_0 | // | 0 0 0 | // //-----------------------------------------------------------------------------// void -Camera::calcProjection() { double alpha_u, alpha_v; // calc alphas alpha_u = _intrinsic[0]; double cot_theta = - _intrinsic[1]/_intrinsic[0]; double sin_theta = sqrt(1/(1+cot_theta*cot_theta)); alpha_v = _intrinsic[3] * sin_theta; double skew = _intrinsic[1]; double u0, v0; u0 = _intrinsic[2]; v0 = _intrinsic[4]; double left = -u0 / alpha_u * _near; double bottom = (_screen_height-v0) / alpha_v * _near; double right = (_screen_width - u0) / alpha_u * _near; double top = -v0 / alpha_v * _near; _projection[0] = 2 * _near / (right - left); _projection[4] = 2 * _near * skew / ((right - left) * alpha_u); _projection[5] = 2 * _near / (top - bottom); _projection[8] = -(right + left)/(right - left); _projection[9] = -(top + bottom)/(top - bottom); _projection[10] = (_far + _near) / (_far - _near); _projection[11] = 1; _projection[14] = -2 * _far * _near/(_far-_near); |} /lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org_______________________________________________ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ------------------ Post generated by Mail2Forum[/quote] There seems to be a mismatch between the projection matrix generated by e.g. makePerspective and the projection matrix elements you suggest here. When I do the comparison between the two, it seems that: _projection[5], _projection[8], _projection[9] and _projection[11] have opposite signs. I'm also a bit surprised that the projection matrix generated by OSG (makePerspective) has -1 instead of 1 for _projection[11]. Maybe that has something to do with the inversion of the Y axis (0,0 in the bottom left instead of the top left) ? Can you give me a suggestion why these differences exist ? Thanks ! Benedikt. ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38253#38253 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Keith Parkins U of R Center for Visual Science [email protected] Meliora Hall, Room 253 office: (585) 275-2460 lab: (585) 275-2230 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

