|On this page…|
The Simulink® 3D Animation™ product is a solution for interacting with virtual reality world models of dynamic systems over time. It extends the capabilities of your and Simulink, SimMechanics™, and MATLAB® software into the world of virtual reality graphics. The product provides a complete authoring, development, and working environment for carrying out 3-D visual simulations.
To use virtual reality worlds to visualize dynamic system simulations, you perform the following tasks:
As you refine your visualization, you often perform some of these tasks iteratively.
To work through an example that illustrates the building, linking, and viewing a virtual world, see Build and Connect a Virtual World.
Install the Simulink 3D Animation software in your MATLAB environment to build virtual reality worlds and to visualize dynamic simulations modeled in MATLAB, Simulink, or SimMechanics. If your computer does not already have a graphics card with hardware 3-D acceleration, consider installing such a card to enhance graphics performance.
You build and view the virtual reality world models using VRML (Virtual Reality Modeling Language).
In addition to the installed VRML editor, 3D World Editor, you can configure your environment to use:
The Ligos® V-Realm Builder, which is included in the Simulink 3D Animation software for Windows® platforms.
Any third-party VRML editor
The MATLAB editor or a third-party text editor
In addition to the installed Simulink 3D Animation viewer, you can use one of these viewers to display your virtual reality worlds:
The Blaxxun Contact® VRML plug-in, on either the host or a client computer
Orbisnap, on a client computer
Use joystick and space mouse input devices to provide input for dynamic simulation visualizations.
The Simulink 3D Animation product uses a TCP/IP connection to a VR client for communicating with the Simulink 3D Animation Viewer, as well for connecting to VRML-enabled Web browser. You can verify the TCP/IP connection between the host and client computers by using the ping command from a command-line prompt. If there are problems, you must first fix the TCP/IP protocol settings according to the documentation for your operating system.
If your system does not have the OpenGL® software properly installed when you run the Simulink 3D Animation Viewer, you might see an error message like the following in the MATLAB window:
Invalid MEX-file 'matlab/toolbox/sl3d/sl3d/vrsfunc.mexglx': libGL.so: cannot open shared object file
If you see an error like this, set the LD_LIBRARY_PATH environment variable.
If the LD_LIBRARY_PATH environment variable already exists, use a line like the following to add the new path to the existing one:
setenv LD_LIBRARY_PATH matlabroot/sys/opengl/lib/<PLATFORM>:$LD_LIBRARY_PATH
If the LD_LIBRARY_PATH environment variable does not already exist, use a line like the following:
setenv LD_LIBRARY_PATH matlabroot/sys/opengl/lib/<PLATFORM>
In both cases, <PLATFORM> is the UNIX® platform you are working in.
Use a VRML editor to build a virtual reality world. A non-VRML CAD model created with another tool can be a good basis for a virtual reality world to use with Simulink 3D Animation. You may be able to convert the CAD model to a VRML model.
The Simulink 3D Animation product uses many of the advanced features defined in the current VMRL97 specification, including:
Viewpoints, to highlight points of interest for quick browsing of a virtual reality world
Sensors, to input virtual reality world values to Simulink models
For more an overview of VRML and details about supported VRML features, see Virtual Reality Modeling Language (VRML).
As you add VRML nodes with the 3D World Editor, you can use the viewer pane to see the virtual world that you are creating.
For a step-by-step example of building a virtual reality world with the 3D World Editor, see Build and Connect a Virtual World.
To use a dynamic system simulation to drive a virtual reality world, you need to connect the virtual world to one of the following:
MATLAB virtual world object
The Simulink 3D Animation library provides blocks to directly connect Simulink signals with virtual worlds. This connection lets you visualize your model as a three-dimensional animation.
You can implement most of the software features with Simulink blocks. Once you include these blocks in a Simulink diagram, you can select a virtual world and connect Simulink signals to the virtual world. The software automatically scans a virtual world for available VRML nodes that the Simulink software can drive.
All the VRML node properties are listed in a hierarchical tree-style viewer. You select the degrees of freedom to control from within the Simulink interface. After you close a Block Parameters dialog box, the Simulink software updates the block with the inputs and outputs corresponding to selected nodes in the virtual world. After connecting these inputs to appropriate Simulink signals, you can view the simulation with a VRML viewer.
The Simulink product provides communication for control and manipulation of virtual reality objects, using Simulink 3D Animation blocks.
For details, see Virtual World Connection to a Model.
You can use the Simulink 3D Animation product to view the behavior of a model created with the SimMechanics software. First, you build a model of a machine in the Simulink interface using SimMechanics blocks. Then, create a detailed picture of your machine in a virtual world, connect this world to the SimMechanics body sensor outputs, and view the behavior of the bodies in a VRML viewer.
For details, see Link to a SimMechanics Model.
Simulink 3D Animation software provides a flexible MATLAB interface to virtual reality worlds. After creating MATLAB objects and associating them with a virtual world, you can control the virtual world by using functions and methods.
From the MATLAB software, you can set positions and properties of VRML objects, create callbacks from graphical interfaces, and map data to virtual objects. You can also view the world with a VRML viewer, determine its structure, and assign new values to all available nodes and their fields.
The software includes functions for retrieving and changing the virtual world properties and for saving the VRML files corresponding to the actual structure of a virtual world.
The MATLAB software provides communication for control and manipulation of virtual reality objects using MATLAB objects.
For details about interacting between MATLAB and virtual reality worlds, see MATLAB Interaction.
After you connect the virtual world to the dynamic system model, use a VRML viewer to view the virtual world representation of the dynamic system simulation.
In Simulink and SimMechanics, simulate the model that is connected to the virtual reality world.
In MATLAB, use the view function to view a vrworld object that the MATLAB code updates with data values.
While running a simulation, you can change the positions and properties in a virtual world.
For information about using VRML viewers to navigate a virtual reality world, see View Dynamic System Simulations.
You can share dynamic system simulation results with others by:
In addition to the single computer configuration (when MATLAB, Simulink, and the virtual reality representations run on the same host computer), Simulink 3D Animation software also allows a client-server configuration. In this configuration, an Orbisnap or Blaxxun Contact VRML viewer on a remote client can connect to the server host on which Simulink 3D Animation software is running. This allows others to view an animated virtual world remotely. Multiple clients can connect to one server. See Blaxxun Contact VRML Plug-In and Orbisnap Standalone Viewer.
Use the MATLAB Compiler™ to take MATLAB files as input and generate redistributable, standalone applications that include Simulink 3D Animation functionality, including the Simulink 3D Animation Viewer. See MATLAB Compiler Support
To use the MATLAB Compiler to produce standalone applications, create a MATLAB file that uses the MATLAB interface for the Simulink 3D Animation product (for example, creating, opening, and closing a vrworld object). Then use the MATLAB Compiler product.
Standalone applications that include Simulink 3D Animation functionality have the following limitations:
No Simulink software support, which results in no access to the Simulink 3D Animation Simulink library (vrlib).
No Simulink 3D Animation server, which results in no remote connection for the Orbisnap or Blaxxun Contact viewers
No animation recording ability
No editing world ability
The following Simulink 3D Animation Viewer features cannot be used in standalone applications:
File > Open in Editor