BehaveRT Documentation

behavertlogo.jpg
BehaveRT is a framework (C++ library) that allows to create real-time massive simulations of behavioral models on Graphics Processing Unit (GPU). "RT" stands for Real-Time.

System description

The BehaveRT provides:
CommonResources
A static access point to the device (GPU) interface and the configuration.
SimEngine
Template for the simulation engine described below.
CommonResources and SimEngine are described in detail in the next two subsections.

CommonResources

By including the main .h file of the framework:
#include "BehaveRT.h"

the namespace of the application will contain m_CommonRes, which is an object of the class BehaveRT::CommonResources.
As you can see in the class documentation, it manages the installation of plugIns and:
DeviceInterface
The interface to device, by using the method BehaveRT::CommonResources::getDeviceInterface. This method returns a reference to the class BehaveRT::DeviceInterface. Thought the DeviceInterface, the SimEngine can access to the GPU. Between the device and the application there are two abstraction levels:
  • CUDA: allows to use the programming model based on threads, and hide the complexity of the GPU.
  • BehaveRT: adds somo facilities in order to run easly behavioral models on GPU. This facilities include a system for call generic CUDA kernels without the need to specify any parameters. Also, the class BehaveRT::DeviceArrayWrapper uses the BehaveRT::DeviceInterface in order to provide a duplux data allocation on host (CPU) and device.
The DeviceInterface is directly used by the SimEngine, described below.
deviceinterface.jpg

Configuration
The library includes the utility BehaveRT::UtilityConfigFile for read data from config file. This utility has been copied from the source files of Ogre3D rendering engine and modified.

SimEngine: Simulation engine

The simulation engine is the earth of the system. This entity manages:
Feature
Features are the data of the simulation entities.
Functionalities
Each method provided by the SimEngine is a functionality. Functionality does operations using features.
The framework provides only a template class for the simulation engine. Features and functionalities are added to the simulation engine by plugIns. The class BehaveRT::SimEnginePlugIn speciefies the interface that each plugIn has to implement.

simengine.jpg

The SimEngine class is created into the user application by using the Mixing classes techinque. This operation allow the user to choose the desired plugIns. By choosing desired plugIns, it is possibile to select the desired set of feature and functionality that the SimEngine must have.

The next section describe how to mix plugIns in order to achieve the desired SimEngine class.

How to use BehaveRT

The user application must contain the plugIn mixing section. The aim of this section is to create the SimEngine class by creating an extension chain of plugIn classes. Here an example:
Proximity3DPlugIn
        <EnvGrid3DPlugIn
                <Body3DPlugIn<DummyPlugIn>>>
                SimEngine;

The class BehaveRT::DummyPlugIn is provided by the framework and it closes the chain. The code in this example merges features and functionalities of Proximity3D::Proximity3DPlugIn, EnvGrid3D::EnvGrid3DPlugIn and Body::Body3DPlugIn.
SimEngine m_SimEngine;

The object m_SimEngine have methods of all plugIns in the chain. For example, it have the method Proximity3D::Proximity3DPlugIn::computeNeighborhoods and EnvGrid3D::EnvGrid3DPlugIn::reorderSimData. This methods belong to two different plugIns.



Picture and Shape flocking demo

This demo allows to try the work presented ad CASA 09 http://hmi.ewi.utwente.nl/CASA09.

GUI

democasa09_screenshot.JPG

Legend:
  • Mode: two available modes: picture flocking/shape flocking.
  • Source: image or 3d model in use.
  • Compute neighborhood: if No both the neighborhood search and the flocking behavior of each flock item are disabled. Set on No to accelerate the simulation. (Default value: Yes).
  • Follow the path: if Yes the 3d model points become checkpoints of a movement path. (Default value: No).

How to use

  • Ctrl + mouse left click + mouse move: rotate camera.
  • Ctrl + mouse middle click + mouse move: change zoom.
  • F1: change mode/source.
  • F2: enable/disable item-item iterations.
  • F3: enable/disable follow the shape.
  • F4: enable/disable avoinding ball.
  • F5: avoinding ball follows the mouse pointer.
  • Space: stop/resume simualtion.
  • Esc: exit simulation.

Software requirements

  • Nvidia CUDA v2.1/2.2/2.3
  • Microsoft Windows XP (to be checked for Vista and Seven).

Hardware requirements

  • Any CUDA-enabled device.
Tested on GeForce 8800GTS, 8800GTX, GTX260, GTX285.

Configuration file

Demo configuration can be changed by means of editing the configuration file config/CSShapes.cfg. The configuration is a set key-value pairs. The file format is the same of Ogre3D configuration files.
Here is a portion of the conf file:
[Drawable3DPlugIn]
neighborhoodColoring=false
colorBase=0.0f 0.2f 0.4f
disableDrawing=false
renderingType=1
meshPath=Data\\pyramid.3DS
useCUDAGeometry=false
numVertexes=1
pointSpriteSizeMultipler=0.01
useSmoothedColor=true

The key renderingType incates the single flock item rendering system. By default the rendering system is 1 = billboard rendering.
renderingType=1 

An other possibile value of renderingType is 2 = OpenGL instancing of the 3D model.
renderingType=2 

The key meshPath indicates the 3D model source.



Author:
Bernardino Frola

Generated on Mon Oct 19 13:19:43 2009 for BehaveRT by  doxygen 1.5.7.1