Configuring a 3D Scene Window

After you create a 3D scene you can configure a separate scene window in which to render the 3D scene.

Complete the following steps to configure a 3D scene window.

  1. Create a 3D scene, or open a VI that contains a 3D scene.
  2. Delete the 3D picture control terminal and remove any broken wires.
  3. Add the Setup Window VI to the block diagram.

     Add  Find
  4. 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 Note   If you set Window State to Hidden, you cannot see the scene window when you run the VI.
  1. Add a While Loop to the block diagram to the right of the existing block diagram objects.

     Add  Find
  2. 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.
  3. 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.
  4. Add the Scene property inside the While Loop, right-click the property, and select Change to Write from the shortcut menu.
  5. Wire the reference output of the Set Drawable method from outside the While Loop to the Scene input of the Scene property.
  6. Wire the New Window Refnum output of the Setup Window VI from outside the While Loop to the reference input of the Scene property.
  7. (Optional) Configure a camera for the scene.
    1. 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.
    2. Add 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.
    3. Wire the reference output of the Scene property to the reference input of the Camera Controller:Type property.
    4. 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.
  8. (Optional) Add the Wait (ms) function to the While Loop to provide smoother camera movements in the scene window. If you do not add a wait to the While Loop, the 3D scene may appear to jump around when you move the camera.

     Add  Find

    1. 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.
  1. Wire error in and error out terminals on the block diagram.
  2. 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 3D Model of Solar System VI in the labview\examples\Graphics and Sound\3D Picture Control directory for an example of a 3D scene rendered in a scene window.

 Open example  Find related examples