Importing Tilt Brush files into Houdini

Although Tilt Brush exports FBX files with the brush stroke geometry sometimes it can be useful to get the data in the .tilt file itself. The .tilt file contains the controller positions, orientations, trigger pressure and timestamps that Tilt Brush then creates stroke geometry from. In my case I particularly wanted the timestamps, as it makes Tilt Brush a simple 6-dof capture solution.

Houdini’s python integration and the Tilt Brush Toolkit make this fairly straightforward.

First you need to get the Tilt Brush Toolkit. You can either clone the git repo or download it from github, and you need to add the Python subdirectory to your PYTHONPATH environment variable.

Now you can use a Python SOP to process the .tilt file and generate geometry. Here is the code I use:

# This code is called when instances of this SOP cook.
node = hou.pwd()
geo = node.geometry()

# Add code to modify the contents of geo.
filename = node.evalParm('filename')

from tiltbrush.tilt import Tilt
tilt = Tilt(filename)

if tilt.sketch.filename:
  filenameAttrib = geo.addAttrib(hou.attribType.Global, "filename", "")
  geo.setGlobalAttribValue(filenameAttrib, tilt.sketch.filename)

brushAttrib = geo.addAttrib(hou.attribType.Prim, "brush", 0)
colorAttrib = geo.addAttrib(hou.attribType.Prim, "Cd", (0.0, 0.0, 0.0, 0.0))
sizeAttrib = geo.addAttrib(hou.attribType.Prim, "size", 0.0)
  
time = geo.addAttrib(hou.attribType.Point, "time", 0.0)
pressure = geo.addAttrib(hou.attribType.Point, "pressure", 0.0)
orientation = geo.addAttrib(hou.attribType.Point, "orient", (0.0, 0.0, 0.0, 1.0))
poly = geo.createPolygon()

for stroke in tilt.sketch.strokes:
  poly = geo.createPolygon()
  poly.setIsClosed(False)
  for cp in stroke.controlpoints:
    point = geo.createPoint()
    point.setPosition([i / 10.0 for i in cp.position])
    point.setAttribValue(orientation, cp.orientation)
    point.setAttribValue(time, cp.extension[1] / 1000.0)
    point.setAttribValue(pressure, cp.extension[0])
    poly.addVertex(point)
  poly.setAttribValue(brushAttrib, stroke.brush_idx)
  poly.setAttribValue(colorAttrib, stroke.brush_color)
  poly.setAttribValue(sizeAttrib, stroke.brush_size)

Now you have each stroke as a curve primitive, with point attributes for position, orientation, pressure and time. The orientation is a quaternion but you can convert that into a more useful normal and up vector with an Attribute Wrangle SOP:

v@N = qrotate(@orient, {0, 0, 1 });
v@up = qrotate(@orient, {0, 1, 0});

Sweeping a line SOP along the curves will give you an approximation of the actual stroke geometry.


No Siggraph calendars for 2016

If you’re looking for Siggraph calendars for 2016 I’m afraid I haven’t had time to put them together this year.  Sorry!


Siggraph 2015 Google calendars

To add to your google calendars, cut and paste the blah@group.calendar.google.com address for the calendar into the “Add a friend’s calendar” box in the “Other calendars” list on the left side of the google calendar page.

Let me know if you see any errors.  The schedule can change, and I endeavor to update these when I see changes.

  • Courses
    8l06oq1i0r1msr2hegqjgaji0o@group.calendar.google.com
      
  • Papers
    899d9osiuvb9n3ke98ikvvk2r0@group.calendar.google.com
      
    (And links to the papers)
  • Talks (including panels)
    55g0chci5ifmsp8crcnor3ubus@group.calendar.google.com
      
  • Special events
    re6h03maiuhmlimhunl0m9p0fo@group.calendar.google.com
      
  • Birds of a feather
    vaav23f89q12t1im1uoakkf1ec@group.calendar.google.com
      

Siggraph 2013 google calendars

To add to your google calendars, cut and paste the blah@group.calendar.google.com address for the calendar into the “Add a friend’s calendar” box in the “Other calendars” list on the left side of the google calendar page.

Let me know if you see any errors.  The schedule can change, and I endeavor to update these when I see changes.  Parties: I don’t get invited to them anymore as I’m nobody’s customer, so you’re on your own 😉

  • Courses
    7dt1m4p5b5csqgi3m8lorogv9c@group.calendar.google.com
    XML iCal HTML
  • Papers
    k0eohhf6ge1q4jjdedm165157s@group.calendar.google.com
    XML iCal HTML
  • Talks (including panels)
    u8oideatih0joc794rur893leg@group.calendar.google.com
    XML iCal HTML
  • Special events
    j9g3t3f12kmqlg2b3r96a87om0@group.calendar.google.com
    XML iCal HTML
  • Birds of a feather
    880kqdmf86cd68rsvcoohp6ar8@group.calendar.google.com
    XML iCal HTML

And maybe I’ll see you all in Anaheim for beers!

Update: See this great set of links to conference content.


Comparing 160-bit hash values with SSE

I’m writing this up as it’s one of those things I was trying to do and thought I’d just be able to crib how to do it from the Internet yet a good amount of googleing turned up nothing.  So here it it for anyone else looking for the same thing.

Read the rest of this entry »


Projection mapping Arthur’s Seat

Here’s something fun I found while clearing out the hard drives on my old pc—my undergraduate graphics project.  Basically it involved projection mapping photographs of Arthur’s Seat (a big hill in Edinburgh) onto a model created from map contours.  Here’s a couple of videos:

Looks like shit, huh?  But it was a big deal for an undergraduate in 1997 😉

Read the rest of this entry »


My first plugin

My first vfx job was with Smoke & Mirrors in London—I use the word ‘job’ in the loosest sense, as they were actually part-sponsoring my doctorate and part of the deal was that they had to employ me for three months over the three years (it was actually more complicated than that, involving a subsidiary that went bust, but that’s a story for another day).

Read the rest of this entry »


Siggraph sketch that never happened

Back in 2003, I submitted a sketch to Siggraph on my thesis work.  I had been working at Framestore for a few months, was waiting for the University to organise my viva and figured that if I got something accepted I might have a fighting chance of getting someone else to pay my airfare to San Diego.

Read the rest of this entry »