LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3D Picture Control, two sided lighting

I'm working on displaying point clouds in LabVIEW using the 3d picture control and meshes drawing points only, the one thing I can't get working is two sided normals, something that I know is supported in opengl (which I believe LabVIEW uses for the picture control) via the glLightModeli method.

 

Can anyone shed any light on whether this is possible in LabVIEW or how I may be able to simulate this functionality so that each of my points reflects from both faces?

0 Kudos
Message 1 of 30
(5,345 Views)

a dumbed down sample VI in 2016 or earlier?

 

I have done point clouds in the 3D picture...

 

UltraSonic.JPG

But is has been a long time.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 30
(5,328 Views)

I've attached a basic VI (LV2016) that shows some example data rendered as a point cloud, the reason for wanting to use specular reflections and hence the normals is that this highlights surface details, due to the nature of point clouds each data point needs to be rendered with two faces to allow this detail to be seen from either side of the model.

 

(The attached VI only has a subset of the data for size reasons)

 

Point Cloud Scan, note the dark areas of non-reflection due to single sided normalsPoint Cloud Scan, note the dark areas of non-reflection due to single sided normals

0 Kudos
Message 3 of 30
(5,300 Views)

Nice. I render my 3D grid with 3 directional layers

3D 1.png

I'll try what happens when I render it with this method.

 

As for the problem... Sadly, NI choose to leave out some OpenGL options, seemingly at will... I think the reasoning was "we don't see how this is useful (in a scene graph), so we'll just remove it to be safe". I was in need of a few options that where in OpenGL, and not in LabVIEW.

 

Definitely frustrating.

 

As for glLightModeli, I'm not sure if it would help it was available: 

GL_LIGHT_MODEL_TWO_SIDE
The param parameter is a single integer value that specifies whether one-sided or two-sided lighting calculations are done for polygons. It has no effect on the lighting calculations for points, lines, or bitmaps. If param is 0 (or 0.0), one-sided lighting is specified, and only the front material parameters are used in the lighting equation. Otherwise, two-sided lighting is specified.
0 Kudos
Message 4 of 30
(5,291 Views)

You aren't working with any Light sources.  Maybe adding the light sources and then setting the properties for specular lighting may helpy ou get where you want to go.  I know from experience that some properties one would automatically associate with 3D pictures are only valid for lighted scenes.

 

Just don't ask me how to do it, I always found it tiresome and complicated.

 

I have wanted to have a normal map for a texture (per pixel) but such a construct does not exist.  There IS a blending option, however which applies and underlying geometry to the texture, but I never understood this and never got anywhere close to a working example to get an idea how it works.

0 Kudos
Message 5 of 30
(5,276 Views)

@Intaris wrote:

You aren't working with any Light sources. 


There seems to be a default light? The image does look lit by a light, and when I add a light 0, this lightning disappears. Tweaking the light results in the same effect as with no added light.

 


@Intaris wrote:

 

Just don't ask me how to do it, I always found it tiresome and complicated.


I concur. The scene graph model really complicates things. Ironically, as it's supposed to make things easier. I'd prefer a solution exposing raw OpenGL functionality. I'd be happy to use the OpenGL API. I own at least 4 books on OpenGL, so I'll manage. 0 books on the 3D picture control though...

 

Of course, at some point a Vulkan interface would be really nice.

0 Kudos
Message 6 of 30
(5,266 Views)

OK, maybe the default light is just what I see.  My recollection was that there were differences between a scene with zero lights and a scene with 1+ lights.  But it might just be that I had never found equivalent settings like you have.

 

I have dabbled at best in the 3D picture control. (My Avatar picture is a result of some of that dabbling)

0 Kudos
Message 7 of 30
(5,262 Views)

As for a solution, I guess rendering the points as a mesh would be an obvious suggestion. But I think the application doesn't allows (as points 'fall out of the mesh')?

 

How about rendering the points as polygons\triangles? Then you might still have the normal problem. But you could then render the mesh twice. Once as it is, once with reversed normal (and triangles). Then render with back faces culled, to get shiny polygons on both sides. *Sigh*.

 

 

Hard? Yes. Try working with transparency if you want a 2nd challenge...

0 Kudos
Message 8 of 30
(5,250 Views)

Appreciate all the ideas so far, in terms of what I've tried:

 

  • the light isn't the problem, adding custom lights does not allow the back faces of the data points to show specular effects
  • rendering two copies of the mesh (as points) with inverted normals on one and back face culling enabled does not work, one mesh seems to take precedence over the other as they exist in the same physical space
  • rendering as polygons/triangles isn't an option, I'll be working with large, un-ordered point clouds of >30,000,000 data points so generating a solid mesh from these would be highly computationally intensive.
0 Kudos
Message 9 of 30
(5,246 Views)

I tried duplicating the points, setting ambient and diffuse to full transparency, inverting the normal for the second set of points....... Trying to get only specular lighting. Didn't work (or at least I couldn't get it to work, those two statements are very much not equivalent.... 🙂 )

0 Kudos
Message 10 of 30
(5,245 Views)