Creating Lens Distort Presets

Hello Kings and Queens,

I have a VERY anamorphic project where I’m looking to make a set of six Lens Distort node presets - One distortion node and one rectification node for each of the three focal lengths used.

I feel like every time I do this I have no trouble creating the undistortion presets - I pull up footage of the grid, draw the splines, eyeball it from there with the output set to auto-resize - but eyeballing my way to a perfect re-distortion node always becomes a process and I was wondering if there’s some reliable way to get a mathematical inverse that I don’t know about.

For anyone curious, my plan is to NeatVideo and undistort all the plates. I’ll use these clips in action + send them to overseas FBX/Roto/Paint vendors, then redistort/regrain all that work and combine it with the original plate with an alpha.

2 Likes

What kind of work will be done on the shots? I tend to force whomever is doing the matchmoving to handle the undistort and provide st maps and Pf Barrel files.

2 Likes

Yeah, I gotta agree with Randy on this. The distortion calculated by the camera track will probably be more accurate than a grid - and also just save you a lot of render time if you don’t have to undistort all your plates beforehand. Especially if you’re sending pre-undistorted plates out for roto and also for tracking and then it’s discovered that the track isn’t accurate unless they use their own distortion solve, then you’re stuck with roto using a different distortion than your track.

Noted on all the above! I’ll be doing some simple 2.5D work like UI and sky replacements, nothing elaborate. I hear y’all on providing distorted plates to the vendor and will probably go that route for this project.

For future reference though, any intel as far as a more efficient way to create matching distortion and undistortion presets within flame? I always spend forever eyeballing my redistort node with a difference transparency context over the original plate to make it a perfect match to my rectifcation node and I have a hunch there’s a more efficient way I could be doing it.

Yeah. The hunch is to not use Flame for this. PF and SynthEyes blow the doors off of Flame in this dept.

3 Likes

I guess I’m asking more for an option for like, relativley unambitious comps like screen replacements that don’t involve an outside vendor. PF rules but there are def situations where I’d just like to undistort, do my billinear, and redistort within the same program, if that makes sense.

2 Likes

Then doing as you are is I believe your only option. If you don’t need anything to truly stick to anything/ be consistent from a Cg perspective, then eyeball for bilienears sake and inverting it is sufficient.

Thanks for all of your help, Mr Sir - The only lingering issue is I can’t figure out how to reliably create an inversion node that matches up without a fuss. I’m guessing this is because I use auto-resize on my undisort node, but I’m not sure what the solution that dosen’t involve changing resolutions is.

Not that this is what you are asking for, but I’ve been trying to convince Autodesk to implement a “Send to tracking software” button similar to how Neat Video works, for precisely these sort of “I don’t REALLY want to export it all for a simple shot” situations.

I just made a feature request for it here

4 Likes

That sounds like a job for Python

1 Like

Machine learning undistort.

2 Likes

My desire is to avoid undistortion altogether. We shouldn’t have to manage it or think about it. Have Action carry the distortion natively in the camera, not on each image node. I put in a FR for that too.

1 Like

Somewhat on-topic, recently had a shit-ton of screen inserts I needed to do, all with a fair amount of lens distortion. I used the lens distort module in mocha to make st maps for undistort and redistort and a little batch setup for dealing with it all. It’s basic stuff but I archived it out and put it on a link if it’s handy for anyone.

This batch was from 2021_1. Filtering is all default so buyer beware.

7 Likes

Yes I know you’re saying. There are many situations where there isn’t the luxury to send things out of house.

This could be what you are thinking of, apologies if this is what you are already doing.

Do a test undistort to see how big the image needs to be, (set to rectification, then resize the output with “optimal resize” on).
Then resize the image before-hand by padding with black, then start a new lens distort based on this new frame size. Now the lens distort rectification and distort modes should invert correctly. I think.

This. Always pad before undistortion to make the inversion work.

PFtrack is really the best way to go then export the UV distort undistort maps out and apply as needed.

To the original question: What we do is resize the footage ahead of time to allow for the additional canvas needed for the undistorted version. Then we work on the footage, reapply the distortion, then resize back to the original resolution. It’s actually super simple once you set it up for each lens you are using in the project. This method allows you to tackle all of the undistorting within Flame so that you can dish out shots to CG/roto/other artist etc. and maintain full control of the image.

3 Likes

Hey All,

cnoellert Christopher Noellert sent me this archive, that has a little more instructions on the workflow! It’s a huge help! and works with ST maps too!

Flame2022 only at the moment, sorry, it’s all. I have.

4 Likes

If you’ve got the Logik Portal, I just uploaded a new script there called Import ST Map. You can use it to import your st maps, then off of those it will build out the whole st maps setup and do any resizing if necessary.

Mike

8 Likes