hku-ect / NatNet2OSCbridge

The NatNet2OSCbridge uses ofxNatNet to decode a NatNet stream from Motive into OSC, which it can then broadcast to clients.
3 stars 2 forks source link

OSC Formatting for TouchDesigner #14

Closed tonyschuite closed 6 years ago

tonyschuite commented 6 years ago

Can we have a Touchdesigner Toggle so the data is named properly in TouchDesigner?

the OSC In CHOP recognises the data properly, however is not naming it in a readable fashion.

ikbenmacje commented 6 years ago

I am going to look into that. good excuse to figure out how OSC in Touchdesigner works

ikbenmacje commented 6 years ago

So, How can we work with live OSC MOCAP data in Touchdesigner in the most simple and friendly way? MOCAP data is a lot of OSC data. The data is organised per skeleton or per rigid body. For a rigid body for example you get 16 values and for each skeleton you get 21 bones where each bone has 8 data points. so that makes 168 values per message.

When you do not use hierarchy mode all the skeleton values are sent in one message thus creating an OSC message with 168 values. With hierarchy mode enabled each bone of a skeleton is a separate message of 8 values.

Within Touchdesigner all the messages ar “unpacked” to create one big list with values or “channels” as it is called in Touchdesigner. This means that no matter if you use hierarchy mode or not (in the NATNET2OSC bridge) or if you sent every separate value as it’s own OSC message, for example: /skeleton/name/Hip/Xposition you will still get one long list of “channels” in Touchdesinger. The "OSC address Scope" can help filter out a range of values to make it more manageble. Together with using the hierarchy mode in the NATNET2OSC bridge.

The biggest problem is that when you send a OSC message with multiple values to Touchdesigner it is unpacked in a not so clear way using numbers. However is you send each value in its own message you create many more OSC messages for the same data which increases the network load significantly.

To filter the incoming MOCAP OSC data the most direct way is touse a number of select nodes where each narrows more and more to the values you want. Alternatively, if you do not want to do this by hand, you can write a Python script to one-time generate these nodes for you based on the names of the bones in the MOCAP skeleton. See attached Tounchdesigner file MOCAP_OSC.toe in MOCAP_OSC_Touchdesigner.zip for reference.

You can also get the OSC data in Tounchdesigner using the OSC_IN DAT (for an example see attached file: MOCAP_OSC_DAT.1.toe in MOCAP_OSC_Touchdesigner.zip ) Where you can also select just the values you want and pass them through.

Concluding I do not think it makes sense to make a separate Tounchdesigner Toggle to name the data properly for Tounchdesigner, but rather look into the best strategies to filter and sort this data.

The example Touchdesigner files where made using: https://github.com/hku-ect/MOCAP_CSV2OSC/releases loading the example dataset.

I do not know Tounchdesigner well, so this question has helped me a lot to get to know the program more.

tonyschuite commented 6 years ago

this can be closed. the outcome is that channels should be parsed in TD.