Jump to content
  • Advertisement
Sign in to follow this  
Catfish

Matching Cinema4d camera - OpenGL camera

This topic is 4014 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to match an OpenGL scene to one generated in Cinema4d. The camera is slightly off - the OpenGL scene appears more zoomed in than the Cinema4d scene. Here's how I'm calculating things : Projection matrix: gluPerspective(cameraFov,viewWidth/viewHeight,10,4000); ModelView matrix: glScaled(1,1,-1); // Left handed coordinate system glRotated(cameraBank, 0, 0, 1); glRotated(cameraPitch, 1, 0, 0); glRotated(cameraHeading, 0, 1, 0); glTranslated(-cameraPos.x, -cameraPos.y, -cameraPos.z); cameraFov, cameraBank, cameraPitch, cameraHeading and cameraPos are all directly taken from the Cinema4d settings. (though Cinema4d's FOV setting is confusing me... I'm struggling to find out whether it's vertical, diagonal or horizontal FOV) There's a couple of related settings (Aperture Width, Focal Length), but AFAICT those are already taken care of by the existing settings... I tried manually tweaking things, and got a cube of known dimensions to match up in both scenes by using an fov of 42ish degrees in opengl (compared to Cinema4d's 53.153 degrees). However, things still look slightly off, as though Cinema4d is stretching the scene into the distance. Any suggestions would be much appreciated... Cat

Share this post


Link to post
Share on other sites
Advertisement
Well The first thing that springs to mind (not having thought too hard about it) is that the field of view quoted in cinema 4D represents a different one to the one used by GLU... remember the FOV can be vertical, horizontal or diagonal (I favour diagonal as this strikes me as most generic) but clearly you could try all the options. If you know the focal length of the lens and the aperture you can work out the exact camera settings yourself... it's worth looking up how camera dimensions (sensor size, aperture, focal length etc) relate... then you can more easily make your in game camera match a physical camera (rather than using something like GLU persepective.
Hope you get it working,

Dan

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!