“I’m Everything” Music Video and SPFX for Piranha
So, one of the guys I work with at iTransact (“one of the guys”… he’s he VP), is Spaff Sumsion (www.spaff.com), who writes lyrics for spoofs of pop songs. Yes, just like “Weird Al”. Local radio personality and music guru, Robert Lund, performs them. Anyway, we were talking one day, and Spaff said, “You do movies? Have you ever done a music video?” Not yet.. but there is a first time for everything. So, we rallied up some friends and shot my first music video. The song is called “I’m Everything” and is a spoof of Michael Bubles “Everything”. We decided the best compliment we could give to the original was not only to spoof the original song, but the original video as well.
So, with about a half dozen friends, we covered everything from the warehouse/studio, costumes, props, and equipment, to the hands doing hair/makeup, wardrobe, camera, grip, b camera, etc. For being a last minute, no-budget deal, we had every major aspect covered. Setting aside a Sunday last week, we put the entire shoot in the can in just under 8 hours.
So, off I am to editing. Its been about a week now, off-and-on (about 10 hours total spent in editing), and its shaping up rather nicely. It doesn’t have the “belly laugh” moments that you imagine going into it… In fact, I’d dare say it’s more “cutsie funny” way, than “riotous”. But that’s fine. Regardless, its turning out great, and I’m having fun doing it. I’m looking forward to the finishing touches and putting it up on YouTube early next month. Keep an eye out.
In the mean time, I’ve been working on some Effects for Piranha to help me finish up the video. I need some blooming/glow effects. This could probably be done in Piranha as is, by stacking a variety of existing plugins, etc. But I’m lazy, I just want a dirt simple plugin, set a few parameters, and move on.
Here is the break-down of what I need done: First, take the current frame, and build a basic luminance map from it. This is simple enough, convert RGB to HSV, and then take V. Apply a nice curve to V to crush the blacks and give a nice ramp that really pops out the highlights, but leaves everything else crushed to black.
After that is done, we end up with a gray-scale image that looks something like this:
Next, we take the luminance map, and perform a basic blur, and a few more tweaks to the luminance curve and you get something that looks like this:
We are almost done. For the sake of giving us some option, and astetic, we apply some color to the gray-scale luminance map, giving it a nice golden tint.
Our final step is to composite this image over our original frame as an “Add” operation. This results in keeping the original image, including in shadow detail, but adding the value of any highlights, and giving a nice roll into clipped highlights. By adding the composite, we retain the golden color of our map. And we get this nice, pretty scene.
At 2k there is A LOT of processing that goes on here. At 4k, its insane. Of all the steps, the blur is by far the most intensive. So, while we can brute force this on the CPU, it will take a lot of time to generate the finished frame. My rough guess, on a Dual Core, 3Ghz, it will probably take 1-2 seconds/frame at 4k. Unacceptable for a real-time system like Piranha. So, its time to offload the heavy work (blurring) to the GPU. Since the other stuff is trivial for the GPU, might as well put it all there.
Piranha supports SPFX. SPFX is basically a specialized interface into NVidia’s Cg shader language, which also convienently provides a integrated, runtime compiler. SPFX defines how Piranha talks to Cg, but in fact, Cg is what does all the real work. This is nice, because Cg is well documented by NVidia, and it a relatively well known language (for Shader programmers– of which I am not).
I spent the last weekend getting familiar with Cg, and writing a few silly plugins, but now its time to get serious. And I need to finish up this music video soon, so time is important. Over the next few days, I’ll post my code as I progress through writing this plugin. While SPFX is specific to Piranha, the bulk of the code (in Cg) is not, and is perfectly portable to any application, game, etc. that supports Gc.