Re: [osg-users] Y up to Z up
Hi Aitor, I was wondering if you had posted an example about what you did. I would like to try out exactly the same. Thanks a lot, cheers Raymond On 4/5/2011 5:03 PM, Aitor Ardanza wrote: Ok, I got it! All my problems were on the orientation of the bones in the model... Now, the avatar is animated well, though a bit slowly ... I will need a more powerful graphics card! I'll post here a small guide in a few days! Thanks to all! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38224#38224 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Hi, as a quick fix when loading the model, or just experimenting, you can use the .rot pseudo loader to put a rotation above your model. Something like: osgviewer cow.osg.90,0,0.rot cheers -- mew -- Mike Weiblen -- Black Hawk, Colorado USA -- http://mew.cx/ On Thu, Mar 31, 2011 at 4:09 AM, Aitor Ardanza aitoralt...@terra.es wrote: Hi, I need to do it for my proyect... but I can't get good results. OpenNI (Kinect) gives me the matrix with Y up: Code: XnSkeletonJointPosition jointPos; g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, jointPos); XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Code: tracker-postMult(C); Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38104#38104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Congrats, Aitor! You must be a happy man! :-) On 4/5/2011 5:03 PM, Aitor Ardanza wrote: Ok, I got it! All my problems were on the orientation of the bones in the model... Now, the avatar is animated well, though a bit slowly ... I will need a more powerful graphics card! I'll post here a small guide in a few days! Thanks to all! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38224#38224 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Yeah, I remember that feeling of elation when the coordinate systems finally lined up and started behaving :-) Nice work! --J On 04/05/2011 11:15 AM, Raymond de Vries wrote: Congrats, Aitor! You must be a happy man! :-) On 4/5/2011 5:03 PM, Aitor Ardanza wrote: Ok, I got it! All my problems were on the orientation of the bones in the model... Now, the avatar is animated well, though a bit slowly ... I will need a more powerful graphics card! I'll post here a small guide in a few days! Thanks to all! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38224#38224 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Hi, I'm back again! I have been looking at the ogre example code, and I've noticed that initializes the bones with a specific angle... Code: void setupBone(const String name,const Ogre::Quaternion q) { Ogre::Bone* bone = mBodyEnt-getSkeleton()-getBone(name); bone-setManuallyControlled(true); bone-setInheritOrientation(false); bone-resetOrientation(); bone-setOrientation(q); bone-setInitialState(); } void setupAnimations() { // this is very important due to the nature of the exported animations mBodyEnt-getSkeleton()-setBlendMode(ANIMBLEND_CUMULATIVE); String animNames[] = {IdleBase, IdleTop, RunBase, RunTop, HandsClosed, HandsRelaxed, DrawSwords, SliceVertical, SliceHorizontal, Dance, JumpStart, JumpLoop, JumpEnd}; //set all to manualy controlled //Ogre::Bone* handleLeft = mBodyEnt-getSkeleton()-getBone(Hand.L); //handleLeft-setManuallyControlled(true); //Ogre::Matrix3 mat; Ogre::Quaternion q = Quaternion::IDENTITY; Quaternion q2,q3; Vector3 xAxis,yAxis,zAxis; q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,-1)); q.ToAxes(xAxis,yAxis,zAxis); q2.FromAngleAxis(Ogre::Degree(90),xAxis); setupBone(Humerus.L,q*q2); q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,1)); q.ToAxes(xAxis,yAxis,zAxis); q2.FromAngleAxis(Ogre::Degree(90),xAxis); setupBone(Humerus.R,q*q2); q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,-1)); q2.FromAngleAxis(Ogre::Degree(45),Vector3(0,-1,0)); setupBone(Ulna.L,q*q2); q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,1)); setupBone(Ulna.R,q*q2.Inverse()); q.FromAngleAxis(Ogre::Degree(180),Vector3(0,1,0)); setupBone(Chest,q); setupBone(Stomach,q); q.FromAngleAxis(Ogre::Degree(180),Vector3(1,0,0)); q2.FromAngleAxis(Ogre::Degree(180),Vector3(0,1,0)); setupBone(Thigh.L,q*q2); setupBone(Thigh.R,q*q2); setupBone(Calf.L,q*q2); setupBone(Calf.R,q*q2); setupBone(Root,Degree(0),Degree(0),Degree(0)); In principle, I dont understand it... This is done to redirect the bones? If we orient correctly from a model editor(maya,blender), we wouldnt need to do this, right? In the model of sinbad for example, the Root bone is oriented with X up. Doing this, setupBone(Root,Degree(0),Degree(0),Degree(0)); will change anything? [Image: http://img577.imageshack.us/img577/2/sinbadn.jpg ] First I will review the orientation of the bones of my models ... and I will publish results ... Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38200#38200 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
On 04/01/2011 08:36 AM, Aitor Ardanza wrote: snip Sorry but I need to disconnect with this issue until Monday... I haven't gotten the animations work well, even putting Y up or with the formula R' = M * R * Minv... On Monday I will try to summarize all my tests with pictures and videos ... I can sympathize :-) It took me a week to get a tracking system with a Z-down/X forward coordinate system to play well with my Z-up/Y-forward apps. Getting different coordinate systems to play well together is probably one of the hardest things to get right. Fortunately, you just have to get it right once, then you can put the code inside a black box and never look at it again :-) --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Hi, I need to do it for my proyect... but I can't get good results. OpenNI (Kinect) gives me the matrix with Y up: Code: XnSkeletonJointPosition jointPos; g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, jointPos); XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Code: tracker-postMult(C); Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38104#38104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Aitor Ardanza writes: What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 That would swap, but also invert some axis (det C = -1). Not sure if that is your intention. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Hi, you might also want to check if Kinect (like D3D) uses a left-handed coordinate system... jp On 31/03/11 11:09, Aitor Ardanza wrote: Hi, I need to do it for my proyect... but I can't get good results. OpenNI (Kinect) gives me the matrix with Y up: Code: XnSkeletonJointPosition jointPos; g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, jointPos); XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Code: tracker-postMult(C); Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38104#38104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Hi Aitor, I don't have a solution (but I am following your work with great interest!) but maybe the Ogre example on openni.org might give you some clues. It can be found here: https://github.com/OpenNI/SampleAppSinbad cheers, have fun Raymond On 3/31/2011 12:02 PM, J.P. Delport wrote: Hi, you might also want to check if Kinect (like D3D) uses a left-handed coordinate system... jp On 31/03/11 11:09, Aitor Ardanza wrote: Hi, I need to do it for my proyect... but I can't get good results. OpenNI (Kinect) gives me the matrix with Y up: Code: XnSkeletonJointPosition jointPos; g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, jointPos); XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Code: tracker-postMult(C); Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38104#38104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Alberto Luaces wrote: Aitor Ardanza writes: What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 That would swap, but also invert some axis (det C = -1). Not sure if that is your intention. -- Alberto ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum Hi Alberto, Yes, if I multiply it by C deforms avatar. reedev wrote: Hi Aitor, I don't have a solution (but I am following your work with great interest!) but maybe the Ogre example on openni.org might give you some clues. It can be found here: https://github.com/OpenNI/SampleAppSinbad cheers, have fun Raymond Hi reedev, I've looked at the ogre code example ... but ogre uses Y up too, but defines the matrix denying some values ... I do not know why, is to invert the matrix? Code: Ogre::Matrix3 matOri(jointOri.orientation.elements[0],-jointOri.orientation.elements[1],jointOri.orientation.elements[2], -jointOri.orientation.elements[3],jointOri.orientation.elements[4],-jointOri.orientation.elements[5], jointOri.orientation.elements[6],-jointOri.orientation.elements[7],jointOri.orientation.elements[8]); Without any change in the matrix, rotations are fine, but the Z and Y axes are exchanged ... If I try to get the euler angles of the array and create a new one with the Z and Y axes swapped, It makes me a curious thing. Let's say an arm turns well but the other does the opposite. I'll keep doing tests ... thanks for the replies! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38115#38115 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Rotate 90 degrees around the x axis (or -90, depends on right- versus left-handed coordinates; try one, then the other, to see which one works). This is not a secret. :-) There is plenty of OSG code that does this. Most of the OSG plugins support an option to transform from a y-up to z-up convention. -Paul On 3/31/2011 3:09 AM, Aitor Ardanza wrote: Hi, I need to do it for my proyect... but I can't get good results. OpenNI (Kinect) gives me the matrix with Y up: Code: XnSkeletonJointPosition jointPos; g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, jointPos); XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Code: tracker-postMult(C); Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38104#38104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Paul Martz wrote: Rotate 90 degrees around the x axis (or -90, depends on right- versus left-handed coordinates; try one, then the other, to see which one works). This is not a secret. :-) There is plenty of OSG code that does this. Most of the OSG plugins support an option to transform from a y-up to z-up convention. -Paul On 3/31/2011 3:09 AM, Aitor Ardanza wrote: Hi, I need to do it for my proyect... but I can't get good results. OpenNI (Kinect) gives me the matrix with Y up: Code: XnSkeletonJointPosition jointPos; g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, jointPos); XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Code: tracker-postMult(C); Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38104#38104 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum Hello Paul! I understand what you suggest me, but I do not know how to apply... because if you multiply that rotation directly to matrix, avatar is deformed. So... if I define the openni global matrix: Code: XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); And then to know the local rotation of each bone ... Code: if(!sceneM-getAnimatedModel()-boneMatrices[j]-getName().compare(R_Shoulder)){ mat.set(osg::Matrix::inverse(*jointsTracker.at(SkeletonJoint::NECK))); mat.postMult(*jointsTracker.at(SkeletonJoint::RIGHT_SHOULDER)); sceneM-getAnimatedModel()-boneMatrices[j]-setMatrix(mat); } and the last action is to apply these local matrix to each bone: Code: pBoneUpdate.at(i)-getStackedTransforms().push_back(new osgAnimation::StackedQuaternionElement(rotate,boneMatrices[i]-getMatrix().getRotate())); Could serve if I define the axes of the nodes in Maya with the axes Z and Y swapped? I do not know if I will clarify things further, or I have left more confused ... jaja. Sorry! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38132#38132 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
You might also consider changing your app to use a y-up convention so that it matches the (apparently immutable) OpenNI modeling space. -Paul On 3/31/2011 9:03 AM, Aitor Ardanza wrote: Paul Martz wrote: Rotate 90 degrees around the x axis (or -90, depends on right- versus left-handed coordinates; try one, then the other, to see which one works). This is not a secret. :-) There is plenty of OSG code that does this. Most of the OSG plugins support an option to transform from a y-up to z-up convention. -Paul On 3/31/2011 3:09 AM, Aitor Ardanza wrote: Hi, I need to do it for my proyect... but I can't get good results. OpenNI (Kinect) gives me the matrix with Y up: Code: XnSkeletonJointPosition jointPos; g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, jointPos); XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); What I have to do to swap the Z and Y axes? multiply that by the matrix C? C = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Code: tracker-postMult(C); Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38104#38104 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum Hello Paul! I understand what you suggest me, but I do not know how to apply... because if you multiply that rotation directly to matrix, avatar is deformed. So... if I define the openni global matrix: Code: XnMatrix3X3 orient; orient = jointOrient.orientation; tracker-set(orient.elements[0], orient.elements[1], orient.elements[2], 0, orient.elements[3], orient.elements[4], orient.elements[5], 0, orient.elements[6], orient.elements[7], orient.elements[8], 0, jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1); And then to know the local rotation of each bone ... Code: if(!sceneM-getAnimatedModel()-boneMatrices[j]-getName().compare(R_Shoulder)){ mat.set(osg::Matrix::inverse(*jointsTracker.at(SkeletonJoint::NECK))); mat.postMult(*jointsTracker.at(SkeletonJoint::RIGHT_SHOULDER)); sceneM-getAnimatedModel()-boneMatrices[j]-setMatrix(mat); } and the last action is to apply these local matrix to each bone: Code: pBoneUpdate.at(i)-getStackedTransforms().push_back(new osgAnimation::StackedQuaternionElement(rotate,boneMatrices[i]-getMatrix().getRotate())); Could serve if I define the axes of the nodes in Maya with the axes Z and Y swapped? I do not know if I will clarify things further, or I have left more confused ... jaja. Sorry! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38132#38132 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
On 03/31/2011 09:35 AM, Paul Martz wrote: Rotate 90 degrees around the x axis (or -90, depends on right- versus left-handed coordinates; try one, then the other, to see which one works). This is not a secret. :-) There is plenty of OSG code that does this. Most of the OSG plugins support an option to transform from a y-up to z-up convention. -Paul Also, if you're trying to rotate an orientation (not just a point), you may need to use this form instead: R' = M * R * Minv Where M is the matrix to rotate from Z-up to Y-up, Minv is the inverse of M, and R is the rotation in the foreign coordinate system. Essentially, the idea is to rotate to the Kinect's coordinate system, apply the Kinect's rotation, then rotate back to your application's coordinate system. It's a bit counterintuitive, but that's how the math works out. --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Y up to Z up
Hi, does anyone knows what this matrix should look like ? Nick http://www.linkedin.com/in/tnick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Trajce Nikolov wrote: Hi, does anyone knows what this matrix should look like ? In row major form, the general orientation matrix is: Xx Xy Xz 0 Yx Yy Yz 0 Zx Zy Zz 0 0 0 0 1 ...where X is the new x axis, Y the new y axis, and Z the new z axis. Matrices don't really know the meaning of the word up; that's a subjective term we use. So when you ask for a matrix that converts y up to z up, you're really asking for a matrix that replaces the y axis with the z axis. Here's one matrix that does that: 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 There are other ways to make a y up to z up matrix, that's just one way. The way you actually choose to compose this matrix will depend on what you want for the x and z axes in the new coordinate system. In the matrix above, I just swapped y and z, and left x unchanged. An alternative would be to negate the new z axis: 1 0 0 0 0 0 1 0 0 -1 0 0 0 0 0 1 -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
That was quick .. Thanks Paul ! Nick http://www.linkedin.com/in/tnick Sent from Devlet, Ankara, Turkey On Sat, Jan 23, 2010 at 8:10 PM, Paul Martz pma...@skew-matrix.com wrote: Trajce Nikolov wrote: Hi, does anyone knows what this matrix should look like ? In row major form, the general orientation matrix is: Xx Xy Xz 0 Yx Yy Yz 0 Zx Zy Zz 0 0 0 0 1 ...where X is the new x axis, Y the new y axis, and Z the new z axis. Matrices don't really know the meaning of the word up; that's a subjective term we use. So when you ask for a matrix that converts y up to z up, you're really asking for a matrix that replaces the y axis with the z axis. Here's one matrix that does that: 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 There are other ways to make a y up to z up matrix, that's just one way. The way you actually choose to compose this matrix will depend on what you want for the x and z axes in the new coordinate system. In the matrix above, I just swapped y and z, and left x unchanged. An alternative would be to negate the new z axis: 1 0 0 0 0 0 1 0 0 -1 0 0 0 0 0 1 -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org