Starting in this release it is possible for hardware to output global positioning data for each channel or skeleton part.
Traditionally each sensor in the mocap system sends position data to MotioBuilder, which becomes a cloud of data markers in
the scene. This in turn is made into a marker set and then associated with an actor. The actor is then used to drive the character
animation in the MotionBuilder scene. This is demonstrated in the sample ordeviceoptical.
So rather than mapping markers to an actor in MotionBuilder, sensors are mapped to the skeleton in the mocap hardware itself,
and the skeleton data and global position information are then sent to MotionBuilder and used to animate the character directly.
This should provide better quality animation than former methods using local skeleton information.
This new sample shows a generic motion capture device using global data streaming from a virtual hardware object. It demonstrates
the use of dynamic allocation of animation nodes/sensors. The sample uses a new function which has been added to the SDK:
FBAnimationNode::SetBufferType.
How to test:
- Prepare the test environment:
- Build ordeviceskeleton.vcproj and skeletondevicetester.vcproj. These create ordeviceskeleton.dll in your plugins directory,
and skeletondevicetester.exe in [MotionBuilder]\bin\[x64|win32].
- Launch the skeletondevicetester.exe. This sets up a TCP/IP server you use to test ordeviceskeleton.
- Launch MotionBuilder to read in the plugin you just compiled.
- Drag Asset Browser > Devices > OR - Skeleton Device and drop it into the Viewer. This creates an instance of the device in
MotionBuilder.
- Toggle on Navigator > Devices > OR - Skeleton Device > Online. If the server (skeletondevicetester.exe) is functioning, you
will see the position data updating in real time. This simulates position data streaming in from an optical device.
- Choose Navigator > Devices > OR - Skeleton Device > Model binding > Create.
- Click Navigator > Devices > OR - Skeleton Device > Setup > Characterize.
- Merge into the scene any characterized character by dragging it from the Asset Browser to the Viewer. You can use Mia or Aragor
from the Tutorials folder in the Asset Browser.
- In the Character Controls select the character, then Edit > Input > DeviceCharacter.
- Click Navigator > Devices > OR - Skeleton Device > Live. The character should now be animated by the data streaming from the
server.
How the device is implemented:
- A function derived from FBDevice::FBCreate creates a new ModelTemplate, and:
- Adds model templates with FBModelTemplate().
- Sets the sampling mode with kFBHardwareTimestamp.
- Next a derived version of DeviceOperation() is called.
- Based on the requested operation (kOp* commands), it calls the corresponding device function.
- It propagates the call to the parent class and returns the result.
- A function derived from FBDevice::Stop()
- Stops the data stream for the device.
- Closes the hardware.
- Returns false (the device is now offline).
- A function derived from FBDevice::Start()
- Opens the hardware (device).
- Gets the hardware setup.
- Begins the channel set definition
- Uses the channels found.
- Ends the channel set definition.
- Defines the model template channel hierarchy.
- Starts streaming data from device.
- Returns true (the device is now online).
- The function DefineHierarchy() builds the hierarchy of model templates.
- The function Bind(), for all channels, creates the translation and rotation animation nodes and creates and binds the model template for the
channel.
- UnBind(): removes the binding and deletes all animation nodes.
- AnimationNodeNotify()
- Gets data from the hardware abstraction.
- Writes data to animation nodes.
- DeviceIONotify(), for the number of data packets waiting to be read:
- Reads the data packet (getting timestamp).
- Records the packet (assigned to timestamp).
- DeviceRecordFrame(), for all the channels that are used:
- Gets the animation node for recording from the node (translation or rotation).
- Gets the data from the hardware abstraction.
- Based on the recording mode for the device, it adds a key for the data.
- Acknowledges the receipt for statistics.