Open Inventor

Introduction

To dramatically simplify your graphics programming efforts and reduce your programming time, Open Inventor includes a rich set of various objects, such as cubes, polygons, text, materials, cameras, lights, trackballs, handle boxes, and 3D viewers.

To make your representation as realistic as possible, you can define material properties (colors, textures, transparencies), shapes, transformations, and animations through engines. You can also add lights and cameras to your scene.

What can users do with objects?

  • define and manipulate their shapes, sizes, materials, textures, etc.
  • apply spatial manipulations
  • add and remove objects or parts of objects
  • represent, save, load, and print them
  • use them for further processing
  • animate them by using engines

Open Inventor presents a programming model based on a 3D scene database consisting of various nodes. Each node holds a piece of information and is composed of a set of data elements called fields, which describe the parameters of the node. The collection of nodes used for representation is called a scene graph. Note that you should define properties before shapes; otherwise, you will not see any effect from these properties.

Open Inventor in MeVisLab

In MeVisLab, most of the Open Inventor nodes are represented by modules, which are organized similarly to the nodes in Open Inventor; for example, there is a cube module for the cube node, a material module for the material node, etc. Refer to ‘Modules’ to gain an understanding of our module concept.

This concept enables fast and easy programming, requiring no prior knowledge of C++, OpenGL, or similar technologies. The only task is to input the parameters of the module, which means parameterizing the fields of the node (though default values are also available). You can learn more about this in the next chapter: ‘Scene Graph.’

Using Open Inventor in MeVisLab does not require C++ coding, which helps avoid typing mistakes and compiling errors. You can quickly see results on the screen and easily change the parameters of the object(s) without recompiling.

The only thing you need to do is conceptualize a scene graph, either mentally or on paper. Then, select the required modules, connect them, define their parameters, and observe the result.

Images/simpleFirstExample.png

The Scene Graph

What is a Scene Graph?

Open Inventor scenes are organized in structures called scene graphs. A scene graph consists of nodes, which represent 3D objects to be drawn, properties of the 3D objects, nodes that combine other nodes for hierarchical grouping, and others (such as cameras, lights, etc.). These nodes are referred to as shape nodes, property nodes, group nodes, and so on. Each node contains one or more pieces of information stored in fields. For example, the SoSphere node primarily contains its radius, stored in its radius field.

The purpose of an Open Inventor file or program is to describe what is known as a scene graph. You can think of a scene graph as a diagram with lines connecting various points. The points represent the objects and properties (referred to as nodes in Open Inventor) that interest you, such as a cube, a cone, or the ability to rotate an object around the x-axis by 45 degrees. The lines indicate the relationships between the points.

For example, collections of simple objects can be grouped together to form a more complex object, in which case the node for the complex object is referred to as the parent node, while the simple objects are called child nodes. Once you have a scene graph, you can use a program known as a viewer to render the scene, allowing you to see what it looks like. (At the top, there is always one type of output node, such as a viewer, write action, or print dialog.) The following image illustrates how our Open Inventor scene graph appears, featuring a directional light node to modify the lighting properties, a sphere node for defining a shape, and an examiner viewer node to render the constructed scene.

Images/sceneGraphTraversal.png

During rendering, the scene graph is traversed starting from the root node, moving from left to right and top to bottom. Nodes to the right (and below) in the graph inherit the traversal state set by nodes to the left (and above). That is why the order is important when defining properties for shapes.

Images/simpleNetworkOrder1.png

Changing the order of evaluation changes the resulting scene.

Images/simpleNetworkOrder2.png

Nodes and Fields

Open Inventor has many different types of nodes that can be included in a scene graph. One type of node describes cones, while another type is used to define the surface appearance of objects, among others. Each of these node types is referred to as a class. All nodes in a particular class share the same types of properties, such as height, width, or location. During the traversal of the scene graph, each node modifies the traversal state based on its fields, which is a collection of elements or parameters.

Images/panel.png

This image shows a panel with the fields of the directional light node used above. You can modify the direction, color components, and intensity of the light. During rendering, these properties are applied to the sphere.

The nodes are instances of various Open Inventor classes. If you can have more than one instance of any particular class of node, each with different characteristics, how does Open Inventor know, for example, if you want one cone to be tall and another cone to be short? Open Inventor keeps track of this information using fields. In the case of the two cones, you would set the height field differently for each cone. Different classes of nodes have distinct collections of fields for you to use. Learning how to use a node class involves understanding what the fields are, what values they can have, and how different field values will affect your scene when viewed.

Field Connections

It is possible to connect two or more fields so that they share the same value. If the field value for the source (there can only be one source) of the connection changes, Open Inventor automatically updates the value of the field at the destination end of the connection. One important use of field connections is in animation. Since the values of the fields in the nodes help determine the appearance of a scene, using connections that cause field values to change over time will result in your scene changing appearance over time, which is achieved through so-called engines.