Extract full resolution (original) gif image (or other media) from a power point file

March 29th, 2015

I’d lost the original to an animated gif that I’d embedded in a previous talk’s powerpoint slide. I tried clicking “Save image as…” but this gave me a lower resolution, scaled version without the animation. Seems there is a well known trick to finding original media in modern Microsoft office files. The .*x files are actually zipped directories. So unzip them to a folder using something like:

unzip myfile.pptx -d myfile/

Then you should find your media files somewhere in this directory. I found mine in: myfile/ppt/media/.


Two-sided material in matlab

March 23rd, 2015

Unfortunately there seems to be no builtin support for two-sided surfaces in matlab. There’s some rudimentary control over back-face lighting, but that’s all. At least you can determine the back-facing triangles for a given camera position:

N = normals(V,F);
BC = barycenter(V,F);
back_facing = sum(N.*bsxfun(@minus,BC,campos),2)<=0;

Here’s an example for an armadillo mesh:

t = tsurf(F,V,'EdgeColor','none','FaceLighting','phong');view(2);
axis equal;
t.FaceVertexCData = 1*(sum(N.*bsxfun(@minus,BC,campos),2)<=0)

armadillo two-sided material

Of course, if you change the view, the coloring is no longer valid:

armadillo two-sided material

So you need to recompute the coloring:

armadillo two-sided material

You can also insert nans to achieve back-face culling:

t.FaceVertexCData(sum(N.*bsxfun(@minus,BC,campos),2)>0) = nan;

armadillo back-face culling matlab

EZproxy bookmarklet

March 20th, 2015

The columbia proxy/vpn never worked super well for me. Or at least I didn’t try very hard to set it up. I really only need it for viewing academic articles off campus. So usually I just search for it via the columbia library’s website, log in, and retrieve the article. Doing this I noticed that the library is just feeding me the usual link (e.g. from acm dl) but via an “ezproxy”. So

http://dl.acm.org/citation.cfm?id=2185544 becomes


I wrapped this replacement into a javascript bookmarklet.


Now I can follow the google search result, hit this bookmarklet, log in if I haven’t already, and view the articles.

Parse a list of numbers without hard coding size

March 19th, 2015

I’ve been used to parsing numbers from strings with the c-style sscanf function. So if I need to read in 3 floats into a vector I’d use something like:

vector<float> v(3);
sscanf(string_to_parse,"%f %f %f",&v[0],&v[1],&v[2]);

This is fine if you know at compile time that the vector will be size 3. But if the number isn’t known at compile time, the c-style gets messy with loops.

Here’s a c++-style solution. Admittedly there are also some messy-looking loops, but I still prefer it. It also makes it easy to have a richer delimiter set.

// http://stackoverflow.com/a/1894955
#include <vector>
#include <string>
#include <sstream>
  using namespace std;
  vector<double> vect;
  string delimeters = ", ";
  stringstream ss(string_to_parse);
  double v;
  while(ss >> v)
    while(string::npos != delimeters.find(ss.peek()))

Skinning Course at SGP Grad School

March 16th, 2015

skinning course at siggraph

I’ll be teaching a version our of SIGGRAPH 2014 course Skinning: Real-time Shape Deformation at this years SGP. Looking at the grad school line up this yea, it seems I’ll be in very good company.

Compiling OpenSubDiv on mac os x with gcc

March 16th, 2015

I had a bit of trouble compiling OpenSubDiv on Mac OS X Yosemite with gcc. I could at least manage to compile the cpu library with:

mkdir build
cd build
make osd_static_cpu

This creates lib/libosdCPU.a. It seems -DNO_GCD=1 is the most critical option as grand central dispatch uses apple’s “blocks” extension C which is only supported by clang.

Skinning Subdivision Surfaces

March 16th, 2015

bounding bunny

Songrun and Yotam have wrapped up the little 3D demo of our Siggraph Asia 2014 paper Skinning Cubic B├ęzier Splines and Catmull-Clark Subdivision Surfaces. Build the demo from source on github.

gluUnProject buggy for canonical views

March 15th, 2015

I just ran into a very frustrating bug in gluUnProject. It seems that if the model view matrix is rotated to align the view axis with the y-axis then gluUnProject is unreliable. Here’s a little example:

Set up you model view, projection and viewport with:

MV = [1 0 0 0;0 0 -1 0;0 1 0 -4.3;0 0 0 1];
P = [1.81066 0 0 0;0 2.41421 0 0; 0 0 -1.00019 -0.0200019; 0 0 -1 0];
VP = [0 0 960 720];

Then given a point in the scene

p = [1.66667 0 0];

project it using gluProject (this seems to work OK):

proj_p = [816.867 360 0.99777];

move it one pixel up (as if with the mouse):

proj_p = [816.867 361 0.99777];

then unproject with gluUnProject:

wrong = [1.80114 -0.345327 -0.00534674];

Where did that movement in the y-direction come from? My guess is the implementation of gluUnProject is doing a bad job inverting the scene matrix in terms of floating point error. Luckily, libigl has an implementation of igl::unproject which uses Eigen’s robust inverse() function. This solved my problem and gives the correct unprojection:

correct = [1.66667 0 -0.00494755];

Fast Automatic Skinning Transformations prototype program on github

February 17th, 2015

I’ve put up the code for my old prototype program corresponding to the paper “Fast Automatic Skinning Transformations” on github. Enjoy.

Stand alone Mac OS X application for “Fast Automatic Skinning Transformations”

February 16th, 2015

Since publishing our paper in 2012, I’ve learned how to bundle up mac os x applications in to stand alone .app’s which include all dependencies (dynamic libraries etc.). This means no installation necessary.

ogre fast app

We’ve had the code up for this project for a while now and it’s now integrated into libigl. You can read about it in the tutorial. But hopefully this little app. Is fun to try now! It also has some features not in the paper, like dynamics.

Eventually I’ll try to host the code for this demo on GitHub. But until download FAST.app. Inside the zip is FAST.app and three example projects armadillo/, octopus/ and ogre/.


Launch the program by double clicking on FAST.app

Open a “Project” directory using APPLE + O

Press ‘t’ to toggle displaying the filled triangles of the mesh.

Press ‘l’ to toggle displaying the wireframe of the mesh.

The “state” of this program is partly determined by which shader is being used. To toggle between shaders, use the ‘<‘ and ‘>’ keys.

Switch to the LBS shader.

Press ‘s’ to toggle displaying the skeleton

Click on individual bones or endpoints to select them.

Press ‘r’ to reset all bones to their rest positions.

Press ‘R’ to reset selected bones.

Right-click and drag on an endpoint to rotate the bone about its parent

Right-click and drag on a bone to wist about its axis

Left-click and drag on a bone or endpoint to translate (not so useful, yet)

The “Fast Automatic Skinning Transformations” method may be activated by setting appropriate parameters in the “AutoDOF” group of the GUI and toggling “Auto DOF” by pressing ‘D’.

Press ‘D’ to turn on “Auto DOF” and wait for precomputation to complete.

Left-click and drag on Yellow endpoints to set position constraints.

Select an endpoint and hit ‘f’ to toggle its type:

|Color  | Constraint type                                |
|Red    | fully constrained                              |
|Pink   | linearly constrained (position is free)        |
|Yellow | positionally constrained (linear part is free) |
|Green  | completely free                                |

Right-click and drag red endpoints to apply full rigid transformations

Help for the GUI is available by clicking the little question mark in the bottom left corner.