VR-Forces 4.2 Class Documentation
3.4 - The Rendering System Layer

Table of Contents

The classes at Rendering System Layer associate some semantics with the geometry.

Instead of just thinking of 3D geometry as generic "nodes", the Toolkit supports application-level concepts like terrain, props, the environment, models, and scene objects. Additionally, the Rendering System Layer contains a DtRenderer that does the actual rendering of pixels to the screen.

3.4.1 The DtOsgRenderer

The component responsible for drawing 3D images in VR-Vantage is called the DtOsgRenderer and each display engine owns one. The DtOsgRenderer is derived from a DtRenderer which is an abstract base class that provides an interface for updating the scene graph and rendering the scene. Its update() and render() functions are called each display engine tick. The renderer also starts the OSG update traversal for updating all nodes in the scene. After the update traversal is complete, the renderer starts the render traversal, which causes the scene to be rendered on all the available channels.

3.4.2 Adding a 3D model to the Scene

VR-Vantage organizes the scene graph is a specific way so that things like lighting work properly. The DtOsgRenderer provides access to the various OSG nodes, such as the prop root node, and other nodes where various models are added. There are several "roots" under which to add nodes. These are defined in DtOsgRenderer::RootDomain and examples include Environment, Terrain and Props.

scene-root.PNG

The simplest way to add a model to the scene is to just add nodes as children to one of these roots. In exampleSceneRoot, we load an OpenFlight model and add it to the props root. A prop a non moving object in the scene that lives under the environment. nodes that live under the environment get lit and shadowed.

3.4.3 Model Instances and Model Definitions

Many aspects of VR-Vantage are configurable via the GUI, such as the 3D model representation an entity uses. Under the hood the GUI writes out a DtModelDefinition for each piece of content that was specified. The DtModelDefinition contains the details required to draw a model, such as geometry, filename, scale, and texture. During runtime a DtModelInstance is created in a display engine and the DtModelDefinition is realized, causing the content to be added to the scene. See exampleModelInstance to learn how to create a DtOsgSimpleModelInstance and realize a DtModelDefinition to add content to the scene. The DtOsgSimpleModelInstance class will load and display any file format supported by OSG and will automatically cache, accelerate, compress, and instance the rendering resources.

3.4.4 Models and Scene-Objects

A DtModel is a managing container for a single DtModelInstance, providing more attributes about how the DtModelInstance should be rendered. Initialization of a DtModel starts with giving it a model definition. Unlike the DtModelInstance, which can be handed a model definition identifying the model to load, the DtModel retrieves a model definition which has been pre-loaded into a definition manager. Usually DtModelDefinition objects are automatically loaded from disk to populate the definition manager.

Initializing a DtModel only loads the geometry and prepares it for rendering. The DtModel has to be place in the scene to be rendered. To add the model to the scene, a DtSceneObject is used to manage the model. The DtSceneObject is a container class that 'groups' multiple models into a single scene-object. A scene-object is an association of models that can be manipulated as a single unit. Among other features, the DtSceneObject identifies a single position and attitude within the scene for all models associated with it. As such, models are added to (and removed from) the scene object to be inserted to (and removed from) the scene itself. Once constructed the DtSceneObject can be positioned and oriented within the scene so that any models added to the object will also be positioned and oriented.

To see how a DtModel and DtSceneObject are created and used see exampleModelArticulation. This example also illustrates the use of a DtOsgArticulatedModel and shows how to move the various pieces of an articulated 3D object.

In most cases it is not necessary to add new model classes. The DtOsgSimpleModelInstance class can load and display any file format supported by OSG and will automatically cache, accelerate, compress, and instance the rendering resources. However, if you need custom visualization, it is easy to add new model classes, and add instances that use the model classes to objects in the scene. If you create custom model classes, you use them by creating a schema and model definition for the new model. Then you map it to an entity type for display.

3.4.5 Rendering System Examples

exampleSceneRoot.PNG

exampleSceneRoot - Shows how to create a very simple VR-Vantage application and add an OpenSceneGraph model directly to the scene.

exampleModelInstance.PNG

exampleModelInstance - Shows how to load a Model Instance with a geometry file from disk and add it to a scene root in a DtOsgRenderer.

exampleModelArticulation.PNG
exampleModelArticulation - Shows how to load an articulated Model Instance, add it to a scene-root in a DtOsgRenderer and animate its articulated parts.

[<< The OpenSceneGraph Layer] [Home] [Top of Page] [The Control Interface Layer >>]


Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)