After you create a 3D scene you can configure a separate scene window in which to render the 3D scene. Scene windows use graphical hardware acceleration, which can offer performance benefits.
Complete the following steps to configure a 3D scene window.
- Create a 3D scene, or open a VI that contains a 3D scene.
- Delete the 3D picture control terminal and remove any broken wires.
- Add the Setup Window VI to the block diagram.
- Right-click the Window State input of the Setup Window VI and select Create»Constant from the shortcut menu. Set the value of the constant to Open, Maximized, or Minimized.
 |
Note If you set Window State to Hidden, you cannot see the scene window when you run the VI. |
- Add a While Loop to the block diagram to the right of the existing block diagram objects.
- Right-click the conditional terminal of the While Loop and select Create»Control from the shortcut menu to create a Boolean control. This control functions as the Stop button for the VI.
- Right-click the New Window Refnum output of the Setup Window VI and select Create»Property for SceneWindow Class»Scene from the shortcut menu to create the Scene property.
- Place the Scene property inside the While Loop, right-click the property, and select Change to Write from the shortcut menu.
- Wire the reference output of the Set Drawable method from outside the While Loop to the Scene input of the Scene property.
- Wire the New Window Refnum output of the Setup Window VI from outside the While Loop to the reference input of the Scene property.
- (Optional) Configure a camera for the scene.
- Right-click the reference output of the Scene property and select Create»Property for SceneWindow Class»Camera Controller»Type from the shortcut menu to create the Camera Controller:Type property.
- Place the Camera Controller:Type property inside the While Loop to the right of the Scene property, right-click the property, and select Change to Write from the shortcut menu.
- Wire the reference output of the Scene property to the reference input of the Camera Controller:Type property.
- Right-click the Camera Controller:Type input of the Camera Controller:Type property, select Create»Constant from the shortcut menu, and set the value of the constant to Spherical or Flying.
- (Optional) Add the Wait (ms) function to the While Loop to provide smoother camera movements in the scene window. If you do not place a wait on the While Loop, the 3D scene may appear to jump around when you move the camera.
- Right-click the milliseconds to wait input of the Wait (ms) function, select Create»Constant from the shortcut menu, and set the value of the constant to an integer of 1 or greater.
The following block diagram shows a configured scene window with a spherical camera controller and a Wait (ms) function in the While Loop.
- Wire error in and error out terminals on the block diagram.
- Run the VI to generate the 3D scene in the scene window.
This procedure gives a basic overview of how to set up a scene window. Use the SceneWindow properties and methods to set additional configuration settings for a scene window, such as window bounds, automatic projection mode or projection matrix programmatically.
Refer to the solarsystem VI in the labview\examples\picture\3D Picture Control directory for an example of a 3D scene rendered in a scene window.