Forum: Poser Python Scripting


Subject: Websockets and facial motion-capture

HartyBart opened this issue on Oct 18, 2021 ยท 14 posts


adp001 posted Mon, 18 October 2021 at 10:43 AM

With "remote control" of Poser I have already occupied myself 10 years ago :)  For a long time for fun and experimentation. At the end I had a website with which I could operate Poser 9/10 completely.   Everything was built from HTML controls.Including a "preview" of what Poser was currently displaying. The main reason was that the powerful server with the Poser installation was in the server room, Poser runs only on Windows and I use only Linux since ages. RDP and the like was just too slow for Poser at that time.

But things have changed over time.

Currently if I do "remote control", I do it with MQTT and a PAHO client adapted for Poser as part of a script for a special purpose.  Mainly it is used to do gestures and poses (funny to watch when several people work on a group of figures in Poser at the same time, sometimes two on the same character).

By the way, MQTT also supports websockets.

If you don't already know what MQTT is: It's a server application that can receive "commands" from "senders" and forward them to all clients that are connected to certain channels. Sender and receiver can be everyone at the same time (who has access to the server and this has not been restricted).

More precisely, the scheme of my implementation is that all Poser instances first load the same figure and log on to the central MQTT server (by starting the script). The script sets up callbacks for all "actors" (i.e. parameters in the actors of the figure), so that the status of the parameters are reported to the MQTT server. The last updated value of a parameter is the current one that is actively reported to the connected clients.
So whichever connected client last turned the Poser dial "arms up":  All connected Poser instances will perform this movement for their character.

Sending a command is trivially simple:
    send(str("[figure name]/[actorname]/[parametername]"), float(value)).
    send("LaFemme/Body/ArmsUp", 0.5)

As you can imagine, these commands can be issued not only with Poser Callback. A client for a smartphone is a snap, especially since there are already quite a few easy-to-use MQTT client apps for e.g. Android/Apple, with which you can build interfaces with buttons, sliders and the like (actually, those are used for "home control").

So the whole thing makes sense even if you don't have several people working together. For example, you can easily do camera and light control with your smartphone. Touch control instead of mouse push and click for Poser :)

Unfortunately, Poser is out of demand for all the interested people I started the development for (Poser 12, "beta status", a lot of security concerns, no future). And so I haven't done anything else on it for over a year.  But the concept will probably be continued with other software for this particular purpose now (hasn't been finally decided yet).