- 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.
- The BehaveRT provides:
- A static access point to the device (GPU) interface and the configuration.
- Template for the simulation engine described below.
- CommonResources and SimEngine are described in detail in the next two subsections.
- By including the main .h file of the framework:
- 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:
- 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:
The DeviceInterface is directly used by the SimEngine, described below.
- 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 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.
- The simulation engine is the earth of the system. This entity manages:
- Features are the data of the simulation entities.
- 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.
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.
- 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:
- 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.
- 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.
This demo allows to try the work presented ad CASA 09 http://hmi.ewi.utwente.nl/CASA09.
- 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).
- 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.
- Nvidia CUDA v2.1/2.2/2.3
- Microsoft Windows XP (to be checked for Vista and Seven).
Tested on GeForce 8800GTS, 8800GTX, GTX260, GTX285.
- 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:
colorBase=0.0f 0.2f 0.4f
- The key renderingType incates the single flock item rendering system. By default the rendering system is 1 = billboard rendering.
- An other possibile value of renderingType is 2 = OpenGL instancing of the 3D model.
- The key meshPath indicates the 3D model source.
- Bernardino Frola