Building/Installing Alembic for OSX

Alembic is a new open-source computer graphics interchange framework being developed by Sony Imageworks and ILM. The basic idea is that moving animation rigs and data and whatnot between packages can be a very tricky procedure since every package has its own way to handle animation, so why not bake out all of that animation data into a common interchange format? So, for example, instead of having to import a Maya rig into Houdini, you could rig/animate in Maya, bake out the animation to Alembic, bring that into Houdini to conduct simulations with, and then bake out the animation and bring it back into Maya. This is a trend that a number of studios including Sony, ILM, Pixar, etc. have been moving toward for some time.

I’ve been working on a project lately (more on that later) that makes use of Alembic, but I found that the only way to actually get Alembic is to build it from source. That’s not terribly difficult, but there’s not really any guides out there for folks who might not be as comfortable with building things from source. So, I wrote up a little guide!

Here’s how to build Alembic for OSX (10.6 and 10.7):

  1. Alembic has a lot of dependencies that can be annoying to build/install by hand, so we’re going to cheat and use Homebrew. To install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
  1. Get/build/install cmake with Homebrew:
brew install cmake
  1. Get/build/install Boost with Homebrew:
brew install Boost
  1. Get/build/install HDF5 with Homebrew:
brew install HDF5 HDF5 has to make install itself, so this may take some time to run. Be patient.
  1. Unfortunately, ilmbase is not a standard UNIX package, so we can’t use Homebrew. We’ll have to build ilmbase manually. Get it from:
http://download.savannah.nongnu.org/releases/openexr/ilmbase-1.0.2.tar.gz Untar/unzip to a readily accessible directory and cd into the ilmbase directory. Run: ./configure After that finishes, we get to the annoying part: ilmbase by default makes use of a deprecated GCC 3.x compiler flag called Wno-long-double, which no longer exists in GCC 4.x. We’ll have to deactivate this flag in ilmbase’s makefiles manually in order to build correctly. In each and every of the following files:
`/Half/Makefile
/HalfTest/Makefile
/Iex/Makefile
/IexTest/Makefile
/IlmThread/Makefile
/Imath/Makefile
/ImathTest/Makefile`
Find the following line: CXXFLAGS = -g -O2 -D_THREAD_SAFE -Wno-long-double and delete it from the makefile. Once all of that is done, you can make and then make install like normal. Now move the ilmbase folder to somewhere safe. Something like /Developer/Dependencies might work, or alternatively /usr/include/
  1. Time to actually build Alembic. Get the source tarball from:

    http://code.google.com/p/alembic/wiki/GettingAlembic

    Untar/unzip into a readily accessible directory and then create a build root directory parallel to the source root you just created:

    mkdir ALEMBIC_BUILD

    The build root doesn’t necesarily have to be parallel, but here we’ll assume it is for the sake of consistency.

  2. Now cd into ALEMBIC_BUILD and bootstrap the Alembic build process. The bootstrap script is a python script:

    python ../[Your Alembic Source Root]/build/bootstrap/alembic_bootstrap.py

    The script will ask you for a whole bunch of paths:

    For “Please enter the location where you would like to build the Alembic”, enter the full path to your ALEMBIC_BUILD directory.

    For “Enter the path to lexical_cast.hpp:”, enter the full path to your lexical_cast.hpp, which should be something like /usr/local/include/boost/lexical_cast.hpp

    For “Enter the path to libboost_thread:”, your path should be something like /usr/local/lib/libboost_thread-mt.a For “Enter the path to zlib.h”, your path should be something like /usr/include/zlib.h

    For “Enter the path to libz.a”, we’re actually not going to link against libz.a. We’ll be using libz.dylib instead, which should be at something like /usr/lib/libz.dylib

    For “Enter the path to hdf5.h”, your path should be something like /usr/local/include/hdf5.h

    For “Enter the path to libhdf5.a”, your path should be something like /usr/local/Cellar/hdf5/1.x.x/lib/libhdf5.a (unless you did not use Homebrew for installing hdf5, in which case libhdf5.a will be in whatever lib directory you installed it to)

    For “Enter the path to ImathMath.h”, your path should be something like /usr/local/include/OpenEXR/ImathMath.h

    For “Enter the path to libImath.a”, your path should be something like /usr/local/lib/libImath.a

    Now hit enter, and let the script finish running!

  3. If everything is bootstrapped correctly, you can now make. This will take a while, be patient.

  4. Once the make finishes successfully, run make test to check for any problems.

  5. Finally, run make install, and we’re done! Alembic should install to something like /usr/bin/alembic-1.x.x/.

Installing Numpy for Maya 2012 64-bit on OSX 10.7

On OSX 10.6, installing Numpy for Maya 2012 was simple enough. You could do it either by directly copying the Numpy install folder into Maya’s Python’s site-packages folder or by adding a sys.path.append to Maya’s UserSetup.py. The process was quite simple since OSX 10.6’s default preinstalled version of Python was 2.6.x and Maya 2012 uses Python 2.6.x as well.

However, OSX 10.7 comes with Python 2.7.x, so a few extra steps are needed:

For Maya 2012 64-bit:

  1. OSX 10.7 comes with Python 2.7.x, but we need 2.6.x, so install 2.6.x using the official installer from here: http://www.python.org/ftp/python/2.6.6/python-2.6.6-macosx10.3.dmg

  2. Since we’re using 64-bit Maya with 64-bit Python, we’ll need a 64-bit build of Numpy. The official version distributed on scipy.numpy.org is 32-bit, so we’ll need a 64-bit build. Thankfully, there is an unofficial 64-bit build in the form of the Scipy Superpack for Mac OSX. Even though we’re on OSX 10.7, we’ll want the OSX 10.6 variety of the script since the OSX 10.7 is Python 2.7.x dependent: http://idisk.mac.com/fonnesbeck-Public/superpack_10.6_2011.07.10.sh

    EDIT (01/12/2012): I’ve been informed by Michael Frederickson that the link originally posted to the unofficial 64 bit Scipy Superpack build for 10.6 no longer works. Fortunately, I’ve backed up both the script and the required dependencies. The install script can be found here: http://yiningkarlli.com/files/osx10.7numpy2.6/superpack_10.6_2011.07.10.sh

  3. Go to where the script downloaded to and in Terminal:

    chmod +x superpack_10.6_2011.07.10.sh ./superpack_10.6_2011.07.10.sh

    If you don’t already have GNU Fortran, make sure to answer ‘yes’ when the script asks.

  4. Once the script is done installing, in Terminal:

    ls /Library/Python/2.7/site-packages/ | grep numpy

    You should get something like: numpy-2.0.0.dev_b5cdaee_20110710-py2.6-macosx-10.6-universal.egg

    Even though we installed Numpy for Python 2.6.x, on Lion it installs to the 2.7 folder for some reason. No matter, you can either leave it there or move it to 2.6.

  5. Go to /Users/[your username]/Library/Preferences/Autodesk/maya/2012-x64/scripts

  6. If you don’t have a file named userSetup.py, make one and open it in a text editor. If yes, open it.

  7. Add these lines to the file:

    import os import sys sys.path.append('/Library/Python/2.7/site-packages/[thing you got from step 4]')

  8. Sidenote: installing Python 2.6.x sets your default OSX Python to 2.6.x, but if you want to go back to 2.7.x, just edit your ~/.bash_profile and remove these lines:

    PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:<span>$</span>{PATH}" export PATH

….and you should be done! In Maya, you should be able to just use import numpy and you’ll be good to go!

GH House Project, a.k.a. Why Backups are Important

Here is a cautionary tale about why backing up one’s harddrive is EXTREMELY IMPORTANT.

Over the summer, I started making a little scene based off of the GH House Challenge from RonenBekerman.com, partially as a way to learn Vray and partially just for fun. I was working off of my laptop for the entire project, since I was in California at the time and didn’t have access to more powerful machines at home. Being out in California for the summer, I brought as little stuff with me as possible.

One of the things I decided to leave home was my backup Time Machine drive. “Oh, I won’t need this over the summer, what are the odds of file corruption or harddrive issues anyhow? I’ll be fine”, I thought to myself.

Which means, of course, that halfway through the summer a bunch of my files got corrupted and were therefore lost forever, and of course that block of lost data included my in-progress GH House project. NEVER ASSUME THAT YOU DO NOT NEED BACKUP.

What follows are some random in-progress renders that survived through being in posts I made to Facebook and Tumblr.

Here are a series of small in-progress renders showing shading and lighting tests:

I also started playing with some ideas for the interior:

…and finally, some larger in-progress renders. These renders represent where the project was when I lost all of the data:

In the end, the fact that I lost the project isn’t as important as the fact that I learned quite a lot from tinkering with this project. However, losing all of the data for this project was definitely a major bummer. But, lesson learned: BACK UP ALL THE TIME.

Animation Final Project Stills

For my Computer Animation class’s final, I decided to go for a change in pace and work in 2D instead of in Maya. I want to tweak a few things before I post the finished animation, but I have two more finals to get through first. So for now, here are some stills:

Why cd when you can go?

I learned a sweet trick from fellow Penn CIS student Alexey Komissarouk’s blog today: the ‘go’ command!

So in a standard *nix bash CLI, you have you’re typical cd command. We all know how to use cd.

But have you ever accidentally cd’d a file? “cd /stuff/blah.txt” makes no sense and just gets you a “Not a directory” error. So then you have to backtrack and use vim or emacs or nano or whatever… blarg. If you’re using emacs or vim, you like efficiency and you’ve already lost efficiency by wasting a perfectly good moment trying to cd into a file.

Enter the ‘go’ command!

Add this bit of code to your .bashrc file and replace $EDITOR with the CLI text editor of your choice:

go()
{
if [ -f $1 ]
then
$EDITOR $1
else
cd $1 && ls
fi
}

and you’re all done! Now when you go to a directory, bash will cd and when you go to a file, bash will fire up vim or emacs or whatever.

As a side note, it might be fun to modify the ‘go’ command even further to automatically launch actions for other filetypes as well, like run javac whenever a .java is encountered or launch .jar files or run gcc or make whenever C++ makefiles are encountered. That’s left as an exercise to the reader though!

Chairs…. now with Balloons!

Oops, I haven’t posted in a while…

A few weeks back I decided to try out overhauling one of my previous projects with VRay. I figured the chairs project would be fun, so…

Wwwwaaaayyyy prettier than before. I really like VRay, although I feel that setting it up is a bit more involved than MentalRay is. Still haven’t made too many inroads with Photorealistic Renderman yet, so I can’t comment on that quite yet.

Oh, also, as you can see, I added balloons too. I like balloons.

I decided to add balloons after seeing an article on RonenBerkerman.com a while back about shading balloons using VRay in 3DSMax. I’m using VRay in Maya, however, so I had to figure out how to recreate the shader in Maya’s Hypershade. The shader network winded up looking like this:

It’s *almost* fully procedural, minus that one black and white ramp image that I wound up using for a lot of things. Replacing that image with a procedural ramp shader to make the entire shader fully procedural probably wouldn’t be very hard at all, but I got lazy :p

I was originally going to post breakdowns of all of the settings for each node in the shading network as well, but again, I’m lazy. So instead, here’s the shader in a Maya .ma file!

A few more renders:

As soon as my last finals are over in about a week, I’ll catch up with my backlog of things that need to be posted. I’m planning on posting a series of posts introducing some concepts in graphics programming that I learned in CIS277 this semester. I’m not going to go super duper in depth (for that, take CIS277! Dr. Norm Badler is an awesome professor.), but at the very least I’ll highlight some of the cooler things I learned. That class was really neat, we wound up writing our own 2D animation software from scratch and our final team project assignment was to build our own 3D modeling software. Basically, we made mini-Maya. My team (Adam Mally, Stewart Hills, and me) got some really neat stuff to work.

Speaking of Stewart, Stewart and I both will be interning at Pixar this summer! We got into their Pixar Undergraduate Program… uh… program. PUP essentially is a 10 week crash course on Pixar’s production pipeline, so we’ll be learning about everything from modeling to simulation to using Photorealistic Renderman. I’m really looking forward to that.