LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3D Picture Zoom and Controller Problems

Hi all

 

I have a bit of a strange problem.

 

I have the 3D image from below which is basically a plane/surface and a sphere/bal. Nothing especial about it.

oscarjgv24_1-1630508348984.png

I want to click the button "Show 2D Plane" and fix the orientation such that it shows me the plane exactly in 2D. The problem is that when I write the "ModelViewMatrix" property node I am no longer able to Zoom In/Out using Shift+Drag Up/Down as I normally would. Moreover, the type of CameraController is changed to "Flying" and it doesn't set to "Spherical" even if I re-write it in the loop. I know this because I used AutoFocus invoke node which gave me a "centered" ModelViewMatrix which was behaving as expected that I then tested to see if writing the exact same values to the ModelViewMatrix would result in the exact same behaviour and it wasn't... it was different, with the aforementioned changes (lose of zooming capabilities and flying controller) being the differences.

 

The images below show a rotation after using AutoFocus

oscarjgv24_3-1630508884176.png

oscarjgv24_4-1630508923364.png

The images below show a rotation after writing the exact same values to ModelViewMatrix. Note the last column.

oscarjgv24_5-1630509114447.png

 

Hope someone can help me out with this.

 

All the best,

Oscar

 

 

0 Kudos
Message 1 of 10
(2,138 Views)

Post (part of) your code.

 

We won't be able to exactly recreate your code, including optional mistakes.

 

Even if we where, it will take time, and that will limit your audience.

0 Kudos
Message 2 of 10
(2,110 Views)

Hi there.

 

Sorry for my late response.

 

Here is the VI that you requested. I modified my code to just include this part which is giving me troubles.

 

The way you can test it is very very simple.

 

1. Press the "AutoFocus" button and tests moving the image of the Surface and Ball that appears. It should have Camera Controller set to Spherical+Auto Redraw, and Auto Projection set to Perspective.

 

From this you should be able to rotate the object as desired, as well as zooming in/out by doing the standard Shift+Drag Up/Down.

 

2. Press the "Copy Actual To Write" button. (You may press "AutoFocus" button again before this). You will see that the values of the "Actual ModelView Matrix" are copied to the "ModelView Matrix To Write". Optionally, write your own values directly in the "ModelView Matrix To Write" in which case, this step is not required.

 

3. Press "Write Model View" which will write the desired ModelView Matrix values. Now test moving the object. First you will notice that the rotation changed (set to flying mode as far as I can tell), and also, you will no longer be able to zoom with the standard Shift+Drag Up/Down method. Surely you can do some clever stuff and modify the values of modelview matrix to zoom in/out as well as rewrite the rotation mode somehow which I am so far unable to do, but I don't want to do that. I want the previous/normal behaviour.

 

4. Press "AutoFocus" again, and all the controllers will be regained as in the beginning.

 

Look forward to hearing back from you.

 

All the best,

Oscar

Message 3 of 10
(2,084 Views)

@oscarjgv24 wrote:

Here is the VI that you requested. I modified my code to just include this part which is giving me troubles.

 

The way you can test it is very very simple.


Kudos for that.

 

I can replicate the problem... I'll look a bit, there's nothing obviously wrong.

0 Kudos
Message 4 of 10
(2,081 Views)

Thank you.

 

Look forward to hearing back from you if you have any luck.

 

All the best,

Oscar

0 Kudos
Message 5 of 10
(2,061 Views)

@oscarjgv24 wrote:

Thank you.

 

Look forward to hearing back from you if you have any luck.

 

All the best,

Oscar


I tried, but I don't have a solution.

Message 6 of 10
(2,046 Views)

Thank you for trying mate. Really appreciate it. Kudos for that!

 

just wondering if perhaps you know another way of doing what I want? To fixate the 3D image to be seen from a given orientation (front-back-top-bottom-left-right, etc.), without afecting the controllers performance, ie. From it changing to flying or Zoom In/Out capabilities....

 

All the best 

Oscar

0 Kudos
Message 7 of 10
(2,042 Views)

You should be able to change the object's position before each redraw.

 

So instead of having a static scene that is viewed by the build in controller, you can monitor the controller, and calculate the desired position of the object.

 

This is tricky, but it's all 'just' matrix manipulation.

0 Kudos
Message 8 of 10
(2,029 Views)

I know how to change the objects position and rotate them, and I've done it. Indeed the purpose of the ball is to represent a UAV inside my flying area (the surface) which I hope to be able to link with Google Maps 3D Data in the near future... This is absolutely no problem for me.

What I don't want to do is to have to do further programming, potentially with event based loops for detecting mouse inputs to manually modify the matrix.... I am sure I can do it, that is not problem... but is further work which is a "distraction" from my main task and I honestly don't have time to do that... not sure why this would be too much to ask in Labview 2021.

0 Kudos
Message 9 of 10
(2,026 Views)

@oscarjgv24 wrote:

What I don't want to do is to have to do further programming, potentially with event based loops for detecting mouse inputs to manually modify the matrix.... I am sure I can do it, that is not problem... but is further work which is a "distraction" from my main task and I honestly don't have time to do that... not sure why this would be too much to ask in Labview 2021.


I concur.

 

I always found the scene graph model a weird choice, especially since there's nothing wrong with OpenGL's API. The problem is that the implemented scene graph model is limited, and apparently flawed. There's so much more OpenGL can do... But since the model, as it is, is closed at all ends, there's little you can do about it. Ironically, the idea was probably to 'dumb down' 3D, while in fact it makes things impossible...

0 Kudos
Message 10 of 10
(2,017 Views)