02-09-2015 04:40 AM
Regarding calculation of normal from the cross product of edge vectors, there's usually a convention to the 'winding' or order in which the edge vectors are specified, so that if you use the same two consecutively ordered edge vectors for each tri, your cross products (i.e. calculated normals) will all point in the same sense- all in or all out of the model surface.
02-09-2015 05:41 AM
Ok, but what I have to do if LV accept only three model format ( stl, vrml or ase http://www.ni.com/white-paper/3170/en/ ) and I can found head models only in stl format on internet? vrml and ase are very rare!
At this point my question is: how I can import correctly a 3D model in Labview?
02-09-2015 05:54 AM
Thanks for your vi posted, but it's looks a very complex solution. It's possible that LV can't import in simplest way a 3D model? In http://www.ni.com/white-paper/3170/en/ says that LV can load only STL, VRML or ASE (the last two are very rare!). If STL format is a blank mesh, how can I apply material to it? I can't find any examples about it.
At this point I change my original question: if you wanted to import a 3D model, how would you do (in the easiest way, of course)?
02-09-2015 10:23 AM - edited 02-09-2015 10:28 AM
thoraz
LabVIEW has developed the VRML 2.0 (or 95, but notice that the 1.0 version is not supported) the preferred format to import into the 3D Picture control. If you have this option, please use VRML (.wrl) format. Unfortunately, the export process depends a lot of the options available on your CAD system and it takes a while to understand its options. I personally used SolidWorks and I noticed that the export (and size) depends of the zoom number to when you are tying to export. Also, there are additional 'option' that you have to set to make it easy to open in LabVIEW (like removing the 'fidelity' number to reduce the amount of polygons).
So, in short, it depends of your CAD system and what is the objective of your animation.
Here is an example of some code where we import a VRML file and an ASE and place them together on the same scene with some movement:
C:\Program Files (x86)\National Instruments\LabVIEW 2014\examples\Graphics and Sound\3D Picture Control\Importing Model and Setting Light.vi
Those example were introduced in 2013 (If I am not mistaken)....
02-09-2015 09:48 PM
A lot of STL models out there don't have normals (it is not a requirement for STL models). Without the normals, you will not get the shading that makes the features come out of a single-color model. Below, I downlaoded a .stl model from the internet and all the normals were 0,0,0. I plotted the model using the equivalent VI's to yours (the "set geometry" method appear to be obsolete). The code and resulting 3D picture are shown below.
The problem is the missing normals. That can be easily fixed by calculating the normals using the vertices of the triangles. Below is the code: