LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use mesh in 3D picture control

Solved!
Go to solution

Hi everyone,

 

I am trying to plot a 2d object within a 3D picture control.

 

The 2d object is a polar plot type data, contour is varying as per the data set. I would like to display this in the 3D picture control, still in 2D. I believe the mesh is the solution. But I can't manage to draw anything into the 3D picture control. Can anyone produce a quick example to show how to draw a polygon mesh in a 3D picture control, where I assume the points on the polygon can be any number.

 

I am very new to 3D picture controls in Labview, never needed them before. But i have managed to produce a nice 3D environment within the 3D picture control, just stuck on this one aspect.


Any help is always well received, and thanks for your time supporting this amazing forum!

 

James  

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 1 of 9
(6,325 Views)
The 'Using Meshes.vi' example is probably better than anything I could come up with quickly.  Nothing is quick with the 3d picture (IMO).
Message 2 of 9
(6,317 Views)
Solution
Accepted by Hillman

Attached is an example that I put together.  If anything is unclear or you want more explanation, let me know and I will do my best

 

Jeff Peters

LabVIEW R & D.

Message 3 of 9
(6,301 Views)

Hi Jeff,

 

Thanks for getting back to me, you've done an Ex-NI UK guy a big help. This is why I love NI, the forum spirit is excellent.

 

The example worked great. I managed to plot my 'polar' type data in the 3d image.

 

I just had one more question , pushing it i know!, I am having real problems finding a good angle to set the camera too.

 

I am trying to view a 3D environment on a robot arena.  I am trying to find an angle where the entire areana is viewable, with enough height to see post the 3D objects. Pretty vage, I know, but any advice you can give regarding camera setup would be great.

 

Regards,

James  

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 9
(6,285 Views)

Here's a vague answer for you,

 

You can set the display to not have any depth distortion so that everything is displayed as projected onto a 2D surface.

 

I think it has to do with camera position and then setting some parameters of the display via property node.  For the life of me (I don't have LV in front of me) I can't remember the name of the property but it accepts a 3x3 matrix of double to set the projection mode.

 

I misused this for a nice filtered wavelength colour bar in the past.  Worked quite well and far better than manually interpolating the colours in a traditional picture display.

 

Hope this helps

 

Shane.

Message 5 of 9
(6,277 Views)

Are you using 8.6 or above?  If so, there is a method on the 3d picture called AutoFocus which will position the camera for you such that your entire scene is visible.

 

If not, you will need to do some calculations to figure out where the geomery will be rendered.  

 

This isn't that hard.  Here is one method:

 

Find the bounding box of your scene, then set the camera's look at position to the center of the bounding box.

 

Then you have to figure out how far back you need to be to see the entire scene. 

 

You can do this by doing some matrix math or you could just find a nice distance, say, pull the camera back twice the depth of the bounding box or something. 

Message 6 of 9
(6,268 Views)

The way I did it was to keep everything within -1 to +1 on teh X and Y scale and then set the viewport to this range.  This leads to a distortion of the aspect ratio of the 3D graph isn't square, but for my application it was fine.  I'll see if I can fidn some code this evening and post a picture of my diagram.

 

Kind of depends on whether you're bothered by aspect ratio distortion or not. 

 

Greetz

 

Shane

Message 7 of 9
(6,254 Views)

Here's what I did to force the corners of the 3D picture to always display -1 to +1 no matter the aspect ratio and without any 3D perspective.

 

3d Mesh viewport.PNG

To the best of my knowledge this removes any 3D perspective operations from the display and basically acts as a projection onto a 2D plane.  It's like working with a 2D picture but textures are handles much better.

 

Shane

Message 8 of 9
(6,242 Views)

Hello friends, I am interesting in this solution because I have the same problem. Could you save the .vi in a LV 8.2 version? Thanks, I appreciate all help from you.

0 Kudos
Message 9 of 9
(5,544 Views)