I’ve made it possible for friends to draw using my 3D printer from within VR.

pancake-f.mp4

Untitled

How it started

I’ve been using my 3D printer for a couple months now, and I’ve started to wonder if I could somehow connect it to a VRChat world so that friends could control my 3D printer with a pen attached to it.

However, so far, I’ve only been printing using a SD card where I put gcode files output from slicing software, and then plug it directly to the printer.

For maximum effect, I wanted the drawing to materialize live with the lowest latency possible.

I’ve asked on Twitter with my basic pitch:

https://twitter.com/vr_hai/status/1618541782899519489

Soon I was told that it’s possible with serial port communication using the USB-B port on my Prusa MK3S+ printer. Thankfully my 3D printer is very close to my main rig, so I immediately plugged it to try.

Prior art

After making this tweet asking for advice on how to send gcode in real time, I’ve been shown examples of prior art, which is cool! This one uses a plotter.

getting an autograph from a vtuber!?? 😱

The plan

To make lines drawn by the pen (by myself or by other players) materialize onto the printer, the plan is to modify QvPen (which is the pen prefab) to output the pen line positions in the game logs using Udon, then write a log parser that will continuously transmit the pen positions as gcode instructions for the printer through the serial port.

Debug.Log the pen position/click/release → Log parser → Remap to gcode → Serial port

This needs to be done with the lowest possible latency for greater effect, as the printer will be live streamed back into the world.

Learning serial port communication and gcode

After a quick google search, I’ve looked at my Device Manager to get the communication port of my 3D printer (the COM ports).

Then I searched up for references on what’s the serial port configuration for my printer (baud rate, etc.), which led to some OctoPrint logs that referenced it.