Using the ReDistort tool

Mar 20, 2008 in Uncategorized

ReDistort IconReDistort - Optically accurate for typical lens distortion.I received an email today from Miles Lauridsen over at Pac Title. He was comparing the results of my ReDistort tool for Shake with the output from SynthEyes applying what (should be) the same algorithm. His report, however, was that the results he was getting were somewhat different using the same distortion value.

I've been comparing your ReDistort shake script to the images produced by outputting a re-distorted image from Synth Eyes and noticed some discrepancies. Namely, the shake script does not distort enough using the same value as in SE. Have you noticed the difference in the image distortions, and if so, have you found a workaround for this?

He's totally right of course, and it's something I'd meant to mention originally. While all the math is the same, there are some noticeable discrepancies in the execution of it in the Shake environment that's always made it a little tricky. (No trickier, of course, than dealing with lens distortion without the tool - it's always a sticky business!) Now, this isn't the first time I've experienced the problem - and truth be told, having it brought up by someone else makes me think I ought to investigate it a little more closely and make the tool work dead-on right away, but I do have a workaround and I figured I'd post my response here. A video walkthrough of this process (and a few other tricks) should be coming along shortly.

My reply to Miles:
Interesting - it's using the same function as SE... or at least was when it was created... Yes, when I've compared them there were some differences but it was pretty subtle, in ways I've always attributed to the way Shake pushes and pulls the pixels in the displaceX.  I wonder if the function has changed.

The math isn't purely reversible so you'll get different results from positive and negative distortion.  I've never been curious enough about it to do more than just make it work, but I'm sure positive vs. negative distortion values should be handled slightly differently.  (I did write a version that adjusts for that, but that's not written into the tool I distributed because it's pretty arbitrary what I did in it)  It's because the node processes the distortion from the viewable image plane, something which actually doesn't work in both directions with the same value (since either one direction or the other is starting with data across a smaller area)

I've always avoided processing the plates through SE since it seems the wrong place for that (though very small studios obviously have reasons to disagree with me - notably having nowhere else to process them)

In cases of strong plate distortion where I suspect the discrepancy might cause slipping, I'd usually pull a plate in through SE, calibrate it in SE so its distortion is compensated for using SE's internals, write out an undistorted plate, then build a shake script with the original plate and the undistorted plate passing into an iSubA.  View the iSubA, add a ReDistort under the undistorted plate from SE and adjust until it's warped back out to the original plate.  You'll see the relief-map appearance at the iSubA reduce to subtle shades instead of harsh lines as it gets close.

That gets you the reverse value that you'll need to use to process a render.  Then you can pass along that value to the compositors or whoever in your pipeline is handling undistortion of the render passes.

Hope that helps.  It's part of what I was hoping to cover when I record the walkthrough tutorial for that tool.  It's not perfect... but it's handy - and we used it @ Asylum for that Propel Stress Monster commercial that we won a bunch of awards for last year, so I feel good about the results.  (It's been used on a lot of stuff, here and elsewhere - it's pretty battletested)

The ReDistort lens distortion tool can be downloaded from here.

Normals relighting, uv retexturing in Shake, crowd generation, lens distortion

Mar 17, 2008 in Uncategorized

Should I go on?

Well, I am.

I just posted a big (to me) update to my Shake Tools page on the main ShakeArtist webpage. It's like a baby I thought would never be born.

DynaCyc Toolkit The DynaCyc toolkit is a spiffy little thing that contains three main tools. The first is called "Forest" - it was originally developed for algorithmically generating dense areas of shrubbery, grass, trees, plants and so on (thus being called "Forest") but I quickly learned that it was also rather handy for replicating a handful of images of people into a large crowd. (That icon is a couple hundred tiny little me-s, wearing dark trenchoats, fedoras and carrying rifles.)

There's a training video for DynaCyc available here.

The other two tools in that toolkit address an issue I used to see a lot when teaching and realized it would be a helpful tool for everyone, not just students. The first one allows you to set a start and end point for an object, indicate an apogee, start time, end time, etc, and have an arbitrary image transformed from the start to the end, arcing in a true parabola (that you can skew to simulate perspective) It seems a lot of people don't realize that freely moving objects ALWAYS travel on a parabolic path (so long as they're in the Earth's gravitational field that is). The last tool, Volley, is what happens if you combine the first two... We can launch hundreds of objects, with a wide variety of adjustable parameters, all driven by some fancy chaos math.

Did I mention that all the tools in the DynaCyc toolkit generate a z-channel when they're done? Oh yes. Yes they do. So it's easy to insert other objects in the midst of them or even to combine multiple instances of those tools in the same scene.

OneLight Normals Relighting ToolkitOneLight Plus is another great kit. Using a rendered normals pass (worldspace please! Object/local normals are for game engines), a diffuse pass, and an ambient occlusion pass, this tool is able to simulate additional light sources being cast onto an already rendered object. The video showing how it normals-relighting works is here. Lightmix is a companion tool that makes it easy to tune the apparent focus, light color and intensity of several of these lighting nodes (and can also come in handy for other lighting tweaks using more traditional methods)

UV Retexturing in Apple ShakeI still don't have the training video for this one online yet, and it may be the hardest of any of them to use. If you're a Shake user, though, you can download the uv-retexturing tool itself from this page and get the video when it becomes available. It makes it possible to do fancy things like add damage to a rendered element, track additional details onto digital doubles, completely replace the texture on an existing render... and it works with up to 16 separate textures at once, each up to 8192 x 8192. Imagine having a cg triceratops (like our little icons) that gets beaten up: you can add wounds, dirt, dust, scratches, etc right there in the comp and they'll stay with him as he thrashes and moves.

Add and Remove Lens Distortion calibrated by SynthEyesThis last one for today is a tool I wrote specifically as a companion to SynthEyes, but it can be used regardless of the visual effects pipeline it's a part of (as long as they have Shake of course). It applies and removes (in an optically-accurate way) lens distortion on plates. You can remove distortion from a film plate, or apply it to a CG render, or even use it to analyze the plate to determine how much distortion is there. There will be a tutorial for that one eventually as well, but for now you'll just have to wing it if you download the lens distortion tool from here.