ST Maps for undistort

Hi all

Apologies for bringing this up again.

The distortion pipeline we have for Nuke is pretty good. Let’s say there is a plate which is 2048x1152 with loads of distortion. We make an ST map which is 2048x1152 and feed it through the right node and it undistorts the plate into the bounding box at 3200x1219.

What I’m curious about is why this can’t be done in flame. As far as I am aware, we need to work out in advance the new size of the canvas and make an ST map to that size. And then it has to be even numbers otherwise it’s not going to distort properly.

We have a workaround using the matchbox export from 3D equalizer but that still needs to have a new canvas size worked out in advance of making it.

My curiosity is making me wonder why flame can’t do it like nuke and just resize the plate by itself? Unless I’m missing something and you’re all doing it like this?

1 Like

I think we’d need someone from ADSK to chime in but as far as I understand it, Flame has always only worked on the whole image raster for every operation. Nuke is clever enough to be able to use bounding boxes to limit where it processes which also means it can hold data outside the actual image raster.

I’d imagine that in order to work like Nuke it’d require a huge amount of work changing the fundamental way Flame handles images and operations. Ultimately, the concept of bounding boxes would have to be introduced.

It’d be great to not have to pad pre-distortion, completely agree. It’s always a little annoying to have to explain to whomever is doing the profiles to make sure they pad beforehand. Flame being Flame and all.

P.S. Unsure if I’m using raster correctly…I mean the image area if not.

So my thinking it this: if the undistort were done in action then the surface could get resized and we could just render out overscan in action and no one has to get upset in cg land. Bounding box is a neat thing but I feel it’s a big rewrite of the software. And I quite like Wizywig compositing myself.

1 Like

That would work, but then you’d need a more powerful and accurate undistortion analysis tool within action itself as the current one can’t compare to what’s available in Nuke let alone 3DE or whatever your tracking software is.

It’s worth noting that Flame can read an EXR w/ information outside the image area by changing the pixel space window from image to data under “format specific options” but once anything hits it from there, it’s whatever that resolution is.

Maybe it’s more that we need a new node that essentially crops an image and takes a STmap at the same time thus allowing the software to know what Nuke would see as being outside the image area. It’d be combining two steps in Nuke into one node in Flame and hacking your way around the negative boundaries…

1 Like

Your suggestion for a new tool UV Warp is valid. My thought was for to make use of action as a hack. But you’re right. Why not just make UV Warp do the same as ST Maps in nuke but instead of pushing picture into the bounding box the plate is resized. It’s sensible.

1 Like

Time for my yearly request then.


I was just thinking about it. I bet this could be accomplished within a Matchbox shader since the STMap is just carrying negative values so I bet someone far more clever than myself could work that out. @lewis would definitely be the one to tell us if it’s possible or not.

In a way, someone already has done that with 3D equalizer. However 3de requires you to enter the overscan you want and it makes a batch with a resize to make the overscan before the matchbox. What might be difficult is getting a matchbox to calculate the overscan on the fly. Might need some complicated algebra if x=anamorphic lens then how big shall I make it sort of sums.

The overscan “should” be the resolution of the STmap since that ought to be larger than the source resolution for the undistort.

Redistort would have to figure out how to map the negative values to match the new incoming resolution and then bring that all back to the source resolution.

… I think … haha. So hopefully user input would be very minimal.

Except in Nuke, the st map can push the overscan outside into bounding box.

True…but then you can read the file using data window instead and it should grab those pixels. I guess the key is whatever is creating that STMap to have it adjust the crop to match the bounding box.

If you add your undistort as a uvmap to your source in action, change the surface type to perspective and then use the image extend (or whatever it’s called) you can pad out the raster, extending it to negative values. Then either use action overscan followed by a resize or plug a custom res black color source into the back and render. The same trick works for redistort.

It’s not bbox, but it’s the quickest way.

Edit: here’s a link I sent earlier of a basic setup—filtering all default. Don’t know if it helps or not as it’s a slightly different use case but the concepts are the same.


As soon as this render finishes I am going to try this!!!

1 Like

Its worth noting that the raster as we’ve been calling it is defined by the input dimensions of the layer. You can easily plug-in a diffuse map from another layer that is oversized as a diffuse of a smaller sized input layer and then use the extend surface controls to pass out the image. Same holds true for all other map types as well.

It’s a great trick for over painting and then pinning back using the original corner-pin data and extending out.


try the UV matchbox it does exactly what your asking for from what I can remember, or maybe it was a Logic but I know their is a matchbox for it, its actually much easier to do it through the matchbox then bringing it into action and sampling the image, so its technically better for the image too.

1 Like

This script will let you import a fbx with st maps and set all the resizing for you. Now that I’m thinking about it, would it be useful at all to have an option where you can just build the st map setup without importing a fbx with it?



Curious to know how you are making the FBX with an ST map @MikeV
Is this using a lens grid to measure the distortion or a tracking software export?

The script doesn’t make a fbx from st maps. It takes a fbx with a camera track, imports it into a action node, switches the action camera to the imported camera. If you have ST maps that were created in another program like syntheyes it will also import those and then create/setup all the nodes needed for the undistort/redistort workflow(resizes and actions with uv maps).


1 Like

For what it’s worth… I’ve been using the 3d equalizer matchbox export method for about a year, and it works perfectly. I’d never want to use an ST map by choice, as it’s more work. The issue over “overscan” seems pretty simple right? It’s a conversation between the matchmove dept and the CGi department. I then expect all renders from CG to be “overscan and undistorted”. Feed it into the matchbox from 3d equalizer and job done. No need for UV nodes, no need to render STmaps etc. Understand that I’m not answering the OP question about why Flame can’t work like nuke’s bounding box workflow, I have no answer there! It was the cause of MUCH PAIN for myself everytime I had to use STmaps to distort/undistort etc there was the inevitable “why don’t you just do it like Nuke!!!” from the CGi guys. At least now I have nothing to worry about and the 3d Equalizer matchbox is fast!


Nice one! That works a treat and is a great and clever solve. Thanks for sharing.

1 Like