Copy link to clipboard
Copied
Hi,
Can I use 3D data to control corner pinning?
I'm a newcomer to AE, trying to comp video footage into a 3D scene. I've got so far, but now I'm completely stuck.
I attached locators to the corners of some flat geometry which moves and rotates through a Maya scene, and I've managed to get these and the animated camera data out using an .ma file.
I've scaled the camera data to fit a rendered sequence of the scene inside AE, so now I have the CGI footage along with a camera and keyframed nulls that precisely match the rendered geometry's movement.
I have a separate video sequence that I want to fit over the geometry, so in essence - a simple screen replacement.
All of the corner pin/camera matching tutorials I've looked at are based on camera tracking from actual film footage, which I don't have. My initial 3D footage from Maya doesn't follow typical 'realistic' movement or physics, so motion or camera tracking doesn't work when I've tried it on the rendered sequence of the 3D scene.
I tried converting the video to a 3D layer and positioning it over the rendered geometry, which works to an extent but it's not entirely accurate.
I was hoping I could pin the corners of the video to the locators, but this shrinks the video layer down to a tiny size.
My nulls have position and rotation data, so is it overkill to use one on each corner, or can I use just one to control everything? I've tried parenting the video to one of the nulls, which gives the correct movement, but the positioning is wrong and I've no idea how to translate it once it's parented.
Is there any way I can motion/camera track the nulls or otherwise use them to position my video layer? I imagine this is precisely what camera and locator data are used for, but I can't work out how.
help!
thanks
J
Copy link to clipboard
Copied
Most of your description doesn't make a lot of sense. Why would the footage shrink just by applying a Corner Pin effect? If that's the case, then you are not using the layer boundaries of the full footage and may need to isolate the layer. It might help to read the online help on how this stuff is actually supposed to work. I'm also not clear why there is rotation data on your Nulls. What for? All that aside, the simple magic ingredient you are missing may be the to World() and toComp() layer space transforms to convert your coordinates via expressions. Anyway, some screenshots certainly would help to clarify your rather confusing description.
Mylenium
Copy link to clipboard
Copied
Hi Mylenium,
Thanks for replying. And yes, I admit it's confusing - I was confusing myself, and don't really know what I'm talking about or how to explain it. I've made a simpler test and I'll try to explain step by step and add screenshots -
I've worked in enough 3D software over the years to know how finicky things can be, and how missing a simple step can mess the whole thing up. I've been looking into precomps, layer bounds, comp sizes and all this; it's not quite sinking in yet and I fear I'm just slapping on more and more conflicting adjustments to counter a fundamental error or omission in the initial setup.
thanks for taking the time to help
Copy link to clipboard
Copied
Don't parent anything. A corner needs to be applied to the plain layer in 2D. The corners can be pinned down with something like:
topLeft=thisComp.layer("Locator 1");
topLeft.toComp(topLeft.anchorPoint)
Rinse repeat for the otehr corners. Otherwise you'd simply place your 3D layer in the scene like you do with 3D tracking, but this may indeed cause mismatches due to the apps using different camera math.
Mylenium
Copy link to clipboard
Copied
thanks,
after some messing around, I got these expressions working after a fashion
they gave this -
after fiddling with the transform position, things did line up pretty well, but clearly not right.
I'm guessing it's something to do with the world, layer, or comp space? None of it is making much sense though, and it feels like I'm going about things in the clumsiest way possible.
Copy link to clipboard
Copied
You may need to use toWorld() and fromWorld() somewhere in there and then toComp() to create a multi-step conversion to account for offsets that may exist. toComp() simply assumes AE default coordinates.
Mylenium
Copy link to clipboard
Copied
Hi,
Thanks for the further advice. I've spent most of the week looking into layer, comp, and world space. I get it, but getting my head around expression syntax and actually applying it is a step too far. So I'll just scrap the project and come back to it once I've gotten used to the software a little more.
Cheers anyway
j
Copy link to clipboard
Copied
The answer you're looking is not "toComp" but rather "fromComp", because the coordinates arrive from an absolute coordinate but you have to rewrite them in relative coordinates.
For example, if you want the position of a null to control a corner of your power pin, then you can just write an expression on your corner:
fromComp(thisComp.layer("Null 1").transform.position)
Your corner pin will now stick to the null regardless of the layer position
Copy link to clipboard
Copied
Oo, thanks.
I never got used to AE; I can't get the hang of code, and too much has to be done in expressions for my liking.
But, if ever I need to battle with this again, I'll remember your post - thanks!
Copy link to clipboard
Copied
I don't think I would be using Corner Pin at all for this kind of workflow. I would simply attach the 3D layer I want to place in the scene to the surface of the appropriate plane in the 3D render. If you have generated position data for 4 3D nulls, you actually only need the position data for 3 of them to establish a plane.
I'd have to see your actual comp and the relevant project files to work out the solution, but corner pin would be my last resort.
If you are stuck with adding a 2D layer to an existing 3D rendered animation, a better corner pin tracking option is Mocha AE. As long as there is sufficient data on the plane you want to track, Mocha will easily attach a layer to any surface and do it with more accuracy and in less time than it takes to corner-pin track in AE.