Category Archives: Uncategorized

OSX & Kinect, 2017

So you have a MacBook (or something else that runs OSX) and you want to play with the Kinect sensor, but you’re having trouble because there are about 1 billion sets of wrong instructions on the internet on how to connect this Kinect. Let me save you a little grief.

Hardware

I have the Kinect “v2”, aka Kinect for Xbox One, aka Kinect for Windows, aka (in my case) Model 1520. The instructions below work for my version. The only serious difference if you have the older Kinect should be that you use a different version of libfreenect, but I haven’t tested that.

Software

You have more than one option as far as software goes. If you’re a commercial developer, you might consider trying out Zigfu’s ZDK, which has an OSX-ready image and integrates with several modern packages, including Unity3d, out of the box.

If you’re more of a hobbyist (as I am at the moment) and don’t have the $200 for a Zigfu license, the lovely folks behind the Structure Sensor have taken on maintenance of the OpenNI2 library, including a macOS build. Your first step should be to download the latest version of that library and unzip it somewhere.

Unfortunately, their package isn’t quite complete, and you’ll also need a driver to connect the Kinect (I know, it’s getting old to me too). This is where our ways may diverge, gentle reader, for in my case I discovered that I needed OpenKinect’s libfreenect2, whereas an older sensor would require libfreenect.

Assuming that you’re using the XBox One sensor, you’ll want to read the README.md that comes with your copy of libfreenect2. It contains all the necessary instructions for getting the right tools + dependencies and building all the things.

There are two additional things that are currently left out of their readme file. The first is that when you want to use the OpenNI2 tools, you’ll need to copy the drivers from

libfreenect2/build/lib

into

{bin-folder}/OpenNI2/Drivers

for whatever you’re running. So to run NiViewer, which is in the Tools folder, you’d copy it to

{openni-base-folder}/Tools/OpenNI2/Drivers

I expected the “make install-openni2” command from libfreenect2’s readme would take care of that stuff, but it does not.

The second omission is the troubleshooting stuff on their wiki. In particular, for my specific MacBook, I had to plug the Kinect adapter into the USB port on the left-hand side, NOT the right-hand side, as the device requires USB3, and I had to run Protonect and NiViewer using the “cl” pipeline. The default pipeline setting can be changed by doing this:

export LIBFREENECT2_PIPELINE=cl

You can also pass in the pipeline for Protonect:

bin/Protonect cl

With that setting in place, you should see a window with 2 (NiViewer) or 4 (Protonect) windows, each capturing different parts of the raw Kinect stream:

 

From here you’re on your own, but I hope you found this at least a bit helpful!

Shadertoy

So you want to write code for a living, but you also have a wee bit of graphic artist in you? Maybe shaders are your glovely medium!

Here’s a small sample of the insanity on display at ShaderToy.

Garage – I haven’t parsed this completely, but I think that entire scene – including the cars – may be a single shader. Note that the car goes both up AND down the decks.

Tentacle Thing – More traditional, akin to the hair shaders supposedly used on the Monsters movies from Pixar, but still amazing to see it running in realtime in a browser.

Seascape – What can I say, except maybe why the hell aren’t there games that have this as part of their experience???

Flame – Simple, but also easy to mess with (try changing the numbers in the mainImage function and hit the Play button below the code window to see what I mean).

It’s hard to imagine the world of the elder statesmen in this field; they were stuck decoding research papers from a variety of obscure journals. But it’s also nice to know that there is such an incredibly rich ocean of knowledge out there to scour while learning to do cool things.

Working!

New stuff happening. I’ll be giving a talk about programming and technical creation in Unity at NGX2016. I’m working on separating the Contension network code from the conflict code so I can start doing up some AI behaviours. I’ve got a bunch of candidate attributes to try out in-game.  And I’ve got a rough idea of the narrative arc of the game.

Next up, I’ll be trying to figure out how to apply the Non Combat episode of Extra Credits to my presentation of the game.