02-22-2010 02:16 PM
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
Solved! Go to Solution.
02-22-2010 02:44 PM
02-23-2010 01:18 AM
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.
02-23-2010 05:24 AM
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
02-23-2010 07:16 AM
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.
02-23-2010 08:38 AM
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.
02-23-2010 11:13 AM
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
02-23-2010 02:25 PM
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.
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
07-06-2011 10:21 AM
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.