Example 7: Add 3D Viewer to OrthoView2D
Introduction
In this example we will use the OrthoView2D module and add a 3D viewer to the layout
Steps to Do
Develop Your Network
Add the modules LocalImage and OrthoView2D to your workspace and connect them.
The OrthoView2D module allows you to select multiple layouts. Select layout
We now want to use a 3D rendering in the top left segment whenever the layout View3D and a SoViewportRegion module to your workspace. Connect the LocalImage with your View3D. The image is rendered in 3D. Hit
SPACE
on your keyboard to make the hidden output of the View3D module visible. Connect it with your SoViewportRegion and connect the SoViewportRegion with the OrthoView2D.
Open the OrthoView2D and inspect your layout.
You can see your View3D being visible in the bottom right segment of the layout behind the coronal view of the image. Open the panel of the SoViewportRegion module. In section X-Position and Width, set
The View3D image is now rendered to the top left segment of the OrthoView2D, because the module SoViewportRegion renders a subgraph into a specified viewport region (VPR). The problem is: We cannot rotate and pan the 3D object, because there is no camera interaction available after adding the SoViewportRegion. The camera interaction is consumed by the View3D module before it can be used by the viewport.
Add a SoCameraInteraction module between the View3D and the SoViewportRegion. You can now interact with your 3D scene but the rotation is not executed on the center of the object. Trigger SoCameraInteraction module.
You have now successfully added the View3D to the OrthoView2D, but there is still a problem remaining: If you change the layout to something different than LAYOUT_CUBE_EQUAL, the 3D content remains visible.
We can use a StringUtils module to resolve that. Set
If the selected layout in OrthoView2D now matches the string StringUtils module is SoViewportRegion is turned on. In any other case, the 3D segment is not visible.
Summary
- The module
SoViewportRegionrenders a subgraph into a specified viewport region (VPR).











