Spherical Harmonics in VOPs

April 11th, 2012 . 2 comments

Spherical Harmonics is a method for efficiently representing values that vary based on angle – often, lighting. It’s been in use for a long time in computer graphics, and with a google search you can find plenty of interesting information explaining the subject, in particular this (now a bit old) paper by Robin Green of SCEA – Spherical Harmonic Lighting: The Gritty Details. The common use case for spherical harmonics is caching a slow-to-calculate value that varies by angle, storing it as SH coefficient data, then reproducing an approximated version of that original value later on. What makes spherical harmonics useful is that for certain types of things (like diffuse lighting) the amount of data you have to store is quite small, and the value can be reproduced later quite quickly.

I’d previously tinkered with SH a bit in blender, but this time decided to port the code in the above paper to VEX in Houdini, implemented as a couple of VOPs, used to generate and evaluate spherical harmonics as part of a VOP network. I started playing with this idea last year at Dr. D, and still haven’t implemented my original ideas yet after getting sidetracked with these fun examples of things you can do with SH. Maybe soon.

You can download this example file, and the OTL here: houdini_sh_otl_hipnc.v001.zip.

The OTL includes three VOPs:

  • SH Generate
    Stores a single float sample along with its corresponding angle in a set of spherical harmonics coefficients. It’s currently using a 4×4 Matrix type as storage for this because it’s convenient to work with in VOPs/attributes, and because 16 floats will allow you to store up to 4 bands of spherical harmonics, which is enough for many situations involving smooth/diffuse values.
  • SH Evaluate
    Evaluates the value of the input spherical harmonics coefficients at a given lookup angle, as a single float.
  • Cartesian to Spherical
    The SH Generate/SH Evaluate VOPs take input angles in spherical coordinates (Phi/Theta),. This VOP can be used to convert a cartesian vector direction, to spherical coordinates.

The OTL was made in Houdini Apprentice, but probably isn’t difficult to convert to a commercial version. If you find any use for this, or any mistakes, please let me know!

Tile necklace

December 28th, 2011 . 4 comments

I made another piece of jewelry for Kat‘s birthday last week – I thought I’d experiment with making a necklace rather than a ring like last time. It’s 3D printed and cast in sterling silver, and sits in three parts. Originally the idea was to have the arrangement customisable so they could be re-positioned along the chain, but in the end only a few combinations hang well in practice. Doing it this way, as opposed to a pendant, is much more complicated than I imagined and will require a bit more experimentation and prototyping if I attempt it again in the future.

The design is inspired by an islamic tile pattern that we saw recently while travelling in Turkey. I modelled it in Houdini by first procedurally re-creating the tiling pattern, then randomly breaking it up and distorting the pieces with some final detailing and bevelling. The final form was chosen by spending a while experimenting with different random seeds and noise offsets to find something that worked aesthetically. I then brought it into Blender for final tweaks, cleaned up the geometry to be watertight, added sprues for ease of casting, and exported the STL file for the print service.

vop pathtracer bsdfs

April 15th, 2011 . 5 comments

Added some different bsdfs to my fun little houdini vopsop pathtracer, trying to see how far I can push things. Now supports perfect specular mirror and fresnel dielectrics – more info on the vimeo page.

Pathtracer vopsop

March 25th, 2011 . 2 comments

So I ended up taking my previous silly Houdini VOPs experiment another step further, and upgraded it to a pathtracer supporting indirect diffuse illumination. More info and hip file are at the vimeo page.

Raytracer vopsop

March 6th, 2011 . 4 comments

Fooling around in Houdini with the intersect VOP today, made a little raytracer inside SOPs. I’m sure its not the first time somebody’s done this, but it was a bit of fun while passing time.

It’s tracing rays from each grid point, doing (soft) shadowed diffuse lighting from a point light, with an optional specular reflection layer with fake fresnel blending.

procedural jewellery

December 23rd, 2010 . 1 comment

It was Kat’s birthday recently, and this year I wanted to do something a bit different for a present. I’ve been getting more familiar with Houdini lately, and thought it would be a good exercise to use it to design a ring, to be rapid prototyped and cast in sterling silver. I was aiming for something geometric with a hint of art deco (which she likes), and I also involved random elements in the production, so the end product would be something quite unique.

Houdini was great for this, I tried to keep it as procedural as possible, giving lots of room for experimentation. The final model was brought into Blender for some more detailing, and export to STL. The printers (rapidprototype.com.au) did a great job, the cast ended up looking great with very well resolved detail in what is a very small piece. I made a little video below showing some of the sop network in Houdini.

Where Am I?

You are currently browsing the Houdini category at Matt Ebb.