3D Viewer

The class E3DViewer .NET Python is an interactive 3D viewer for point clouds, ZMaps, meshes and basic shapes (lines, planes, boxes and spheres).

  • It features multiple sources display, color ramps, 3D point picking and text label display.

  • It is compatible with Windows and Linux and can be integrated to Win32, MFC and QT frameworks.

Creating a 3D Viewer

  • The general constructor of a 3D viewer is:
    E3DViewer(EUIAPI uiApi, int orgX, int orgY, int width, int height, void* parent)

  • The way to use it depends on the Operating System and the User Interface API.

Windows Only

  • To create a 3D viewer stand-alone window:

    • Use E3DViewer(EUIAP.EUIAPI_Win32, orgX, orgY, width, height)

  • To create a 3D viewer as a part of another window in an MFC application:

    • Use E3DViewer(EUIAP.EUIAPI_Win32, orgX, orgY, width, height, handle to the parent window)

    • See the MsVc or MsVcs Easy3DViewer sample.

Windows and Linux

  • To create a 3D viewer in a Qt application:

    • Use E3DViewer(EUIAP.EUIAPI_Qt, orgX, orgY, width, height)

    • You must instance the class inside a QOpenGLWidget object.

    • See the Easy3DViewer Qt sample.

Managing the Render Sources

../../../_images/3d_viewer_01.webp

A point cloud displayed in gray scale and a mesh in false colors in the 3D viewer

Point cloud displayed with constant color. Point cloud displayed with constant color.
Point cloud displayed using a color ramp. Point cloud displayed using a color ramp.
Point cloud displayed using color attributes. Point cloud displayed using color attributes.

Data courtesy of Zivid.

../../../_images/3d_viewer_05.webp

A mesh with wireframe and transparency, combined with a point cloud with color ramp

Shading

E3DViewer .NET Python can shade rendering sources using a custom version of the Eye Dome Lighting (EDL) technique.

EDL is a post processing technique. It impacts all opaque render sources all together. With EDL, pixels that are closer to the camera occlude neighbor pixels that are further away from the camera.

Mesh with EDL disabled. Mesh with EDL disabled.
Mesh with EDL enabled. Mesh with EDL enabled.

Using a Color Ramp

Point cloud with color map mode `Hue from X`. Point cloud with color map mode `Hue from X`.
Point cloud with color map mode `Hue from Y`. Point cloud with color map mode `Hue from Y`.
Point cloud with color map mode `Hue from Z`. Point cloud with color map mode `Hue from Z`.
Point cloud with color map mode `RGB cube`. Point cloud with color map mode `RGB cube`.

To keep the same color ramp bounds instead of adaptive ones, use E3DViewer::SetFixColorRampBounds .NET Python.

../../../_images/3d_viewer_10.webp

A color ramp EColorRampMode_HueFromZ .NET Python with outlier removal process. The extreme points with Z coordinate between 8.3 and 18.8 are drawn in red; the Z coordinate of 98% of the points are between -6.7 and 8.3

Interactive Controls

On Windows, the interactive controls are built in the class E3DViewer .NET Python.

  • The following interactions are possible:

Interaction

Control

Rotate the view

left-click + mouse move

Translate the view

right-click + mouse move

Change the view distance

mouse wheel

Reset the view

r

View along the positive / negative X axis

x / Shift+x

View along the positive / negative Y axis

y / Shift+y

View along the positive / negative Z axis

z / Shift+z

Show / hide the axis

a

Enable / disable the wireframe mode

w

Increase / decrease the point size

plus sign (+) / minus sign (-)

See also

Sample program: Qt Easy3DViewer.

View Parameters

You can customize the 3D view and:

Point cloud displayed with no axis. Point cloud displayed with no axis.
Point cloud with a world-centered axis. Point cloud with a world-centered axis.
Point cloud displayed with a bounding-box axis. Point cloud displayed with a bounding-box axis.
Point cloud with an axis and a grid. Point cloud with an axis and a grid.

Picking a 3D Point

  • Picking a point means detecting the point closest to the given coordinates in a E3DViewer .NET Python window. You can then display the detected 3D point, with attributes, as a text label.

../../../_images/3d_viewer_15.webp

Displayed coordinates and attributes of a picked point on the 3D view

Text Labels and 3D Objects

  • You can add custom text labels and 3D objects to the current view of the 3D viewer.

../../../_images/3d_viewer_16.webp

A screen label in the top left corner and a text label with 3D anchor

An E3DObject .NET Python contains several features (center point, bounding box, base plane…). Use the methods E3DViewer::ShowFeatureFor3DObject .NET Python / E3DViewer::HideFeatureFor3DObject .NET Python and E3DViewer::ShowFeatureForAll3DObjects .NET Python / E3DViewer::HideFeatureForAll3DObjects .NET Python to select the displayed features.

See the Easy3DObjectExtract MSCV sample as an example for the display of E3DObject .NET Python.

../../../_images/3d_viewer_17.webp

3D objects drawn with a point cloud displaying the bounding boxes and the top positions