Jump to content

Setup 3D Camera Method


Recommended Posts

So I've been working with the OpenGL stuff for about a year or so on and off, and I have become pretty proficient. There is one thing that I can't seem to figure out, however. I have been trying to control the camera using the setup camera method, and I can't figure out what the up direction is. I thought it described a (unit) vector that pointed out of the top of the camera, but I'm certain that this is not the case, although it seems to be the case sometimes, however in some positions the camera inverts itself. The help files on this method are not useful, which is pretty much the case for most of the OpenGL stuff, unfortunately. Does anyone know how to use this method?

~Jo-Jo

Link to comment

QUOTE(Jo-Jo @ Dec 5 2007, 02:53 PM)

So I've been working with the OpenGL stuff for about a year or so on and off, and I have become pretty proficient. There is one thing that I can't seem to figure out, however. I have been trying to control the camera using the setup camera method, and I can't figure out what the up direction is. I thought it described a (unit) vector that pointed out of the top of the camera, but I'm certain that this is not the case, although it seems to be the case sometimes, however in some positions the camera inverts itself. The help files on this method are not useful, which is pretty much the case for most of the OpenGL stuff, unfortunately. Does anyone know how to use this method?

~Jo-Jo

Are you programming in LabVIEW? If not, you may be in the wrong place. There is a toolkit for LabVIEW called OpenG that may have accidentally pointed you here.

Link to comment

QUOTE(JDave @ Dec 5 2007, 11:13 PM)

Are you programming in LabVIEW? If not, you may be in the wrong place. There is a toolkit for LabVIEW called OpenG that may have accidentally pointed you here.

Yes, I'm programming in LabVIEW. The setup camera method is a method of the 3D picture indicator.

Link to comment

QUOTE(Jo-Jo @ Dec 5 2007, 03:34 PM)

Yes, I'm programming in LabVIEW. The setup camera method is a method of the 3D picture indicator.

Sorry. :oops: I didn't recognize what you were referring to. And I haven't used the 3D picture yet, so hopefully someone else will be able to help out.

David

Link to comment

QUOTE(martin@aerodynamics @ Dec 6 2007, 07:07 AM)

These help files deal with the built-in camera controller. There is no reference to the method I mentioned in my post. Has anyone here figured out how to successfully use the Setup Camera method? I'm starting to think that it actually doesn't work. I received no response from anyone on the NI developers forum either. I sent an email to NI's application engineers, but I haven't heard from them yet either. I can manipulate the OpenGL camera using C++, and I'm not new to OpenGL, or LabVIEW, (so don't assume that I'm screwing it up in some simple way) but in LabVIEW the only way the give to use the camera is with the Setup camera method, and I have yet to see a demonstration of it working other than putting the camera in a static position with the up direction parallel to the positive Y axis.

Link to comment

QUOTE(Jo-Jo @ Dec 6 2007, 10:39 AM)

in LabVIEW the only way the give to use the camera is with the Setup camera method, and I have yet to see a demonstration of it working other than putting the camera in a static position with the up direction parallel to the positive Y axis.

Have you checked out the solarsystem.vi in the labview\examples\picture\3D Picture Control directory. It might have what you need.

Link to comment

QUOTE(TobyD @ Dec 6 2007, 09:47 PM)

Have you checked out the solarsystem.vi in the labview\examples\picture\3D Picture Control directory. It might have what you need.

The solar system VI sets up the camera with the top of the camera parallel to the positive Y axis, and then doesn't move it except with the built-in grabby cursor. What I'm trying to do is move the camera to anything location with an arbitrary orientation. I worked out the math, it is the same as for any object, but the camera does not seem to be responding properly.

I have an email into NI. If I hear anything, I'll let you guys know. This method is very important, I can't believe I'm the only one trying to use it, but so far I haven't found anyone who is trying to use it except to establish a static view.

Link to comment

Alright, I got it. This is a little counterintuitive, so try to stick with me here, as I'm sure I won't be the only one to run into this problem.

So when the camera is translated the target is the point the camera is looking at in the absolute coordinates of the scene. The up direction, however, is the direction the top of the camera is pointing in relative to the camera. To complicate things more, the camera can be thought of as having its own coordinate axes apart from the scene axes, as is ture of every other OpenGL object, which is what the up direction vector uses, but these axes do not rotate with the camera, which is what happens with every other OpenGL object.

On a related note, you can get the most amount of control from the camera by making the target a unit vector that moves with the camera, so the camera is always focused a distance of one in front of itself. As an example check out the following setup:

If the camera is at the following location:

10,10,10

and it is rotated in pi/2 radians around X axis. The target (using the above unit vector method) will be:

10,11,10

But the up direction will be:

0,0,1

The moral of the story is: Don't think of the target and up direction as two vectors 90 degrees out from each other with their tails at the same point in the same coordinate system.

Hope this helps.

~Jo-Jo

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.