ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# simulating per polygon texture mapping in AE

FAQ   •   VIEW ALL
 simulating per polygon texture mapping in AE on Feb 21, 2015 at 11:41:20 pm

Every day I come with a new way to do this and every day AE lets me down with what looks like non linear math in all of it's warpers.

I'll describe what I"m trying to do as I would in any 3D package - there it works perfectly, since the math for polygon tessellation and texture mapping... well, just works (thankyou, Ed Catmull).
Take a simple polygon (3 or 4 sides) and put a texture on it in any 3D package (flat mapped not UV). Then "stick" that texture (or bake or fix or freeze as per your package's lingo) and then change the position of the vertices of that polygon and the image will warp to fit the new shape in a proportional way. (by proportional, I mean: It would be the equivalent of just turning a real 2D photo in 3D space - the image would change from your point of view based on perspective but to a third party whom the image was now facing, it would look perfectly "square")

I need to do the same thing in AE with only native plugins.

Attempts:

Reshape - this was going to be my savior because it works pretty much the same way changing the vertices does in 3D. The overall effect works of course but there is significant curved warping going on at full resolution, that does not happen in a properly texture mapped poly in a 3D package (this effect sometimes does not show up in AE at half or quarter res - see my last post on the subject). Also depending on "the before" and "after" shape this curvature can be extreme and variable - there doesn't seem to be any rhyme or reason to it. If you took two triangular masked areas of a grid and had the two masks share a common side, and then reshaped the masks to new shapes, leaving the common side unchanged, the grid would warp but would no longer line up along that common side (see images) - why not? This is true even if you use two sources, one for each mask set as I have done in the images. And yes I've added more correspondence points and it helps to a point, but usually by the time I add enough to fix certain things it makes a mess of other areas.

CCPower Pin - this gets the closest to the proper effect. In fact, depending on the before and after shape it can be bang on. Two issues: First it's very time consuming and very much trial and error warping the image to conform to the new end shape. Since most "poly" shapes are triangular, the four corner points aren't really working in a one to one ratio like they would with a standard four sided image.
Second: there is still a non proportional warping going on; but not curving like in Reshape. So if a grid was used as an image, after the warp there would be larger squares in the corners of the triangle and smaller squares in the middle after the warp.

Corner Pin - same issues as Power Pin plus the added annoyance of image softness due to the terrible supersampling that has always been problematic in this outdated plug in.

Mesh-warp: Used in combination with Power Pin this will get me there (but wow is it tedious), however it too needs a revamp in the supersampling department as it produces soft results and always has.

Bezier Warp. Same issues as above plus the added benefit of the math expecting curves so you can really get into trouble.

Puppet tool: This was never designed to be linear or proportional and just by looking at the mesh you know it's not going to do the job (but it works great for what it was designed for)

3D planes: The first thing you thought of right? Me too. I could probably get there from here if I could find the right focal length, distance from camera, angle of plane, and lens distortion, but with that many parameters I'd be better off to go buy a lottery ticket which would have better odds. Remember I have a specific quadrilateral or triangular shape, that, when the plane is rotated in 3D, must align exactly to a new polygon shape when viewed in the 2D comp window. And I have to do it for about 40 different shapes. Much harder than it sounds. And, due to AE being pseudo-3D, probably impossible.

I have also tried all of these in combination - Power Pin and then a mesh warp to fix the non linear pinning etc. But there is always another issue that crops up.

So after all that I'm out of ideas. Any would be appreciated.
I have included some images so show how perfect this works in a package that can properly texture map, then one image in AE where it's just a mess. (and this is one of the better attempts!)

 Re: simulating per polygon texture mapping in AEon Feb 24, 2015 at 4:34:22 pm

[Steve Bentley] "I need to do the same thing in AE with only native plugins."

I know this is not a helpful answer given your parameters, but I rely on tools from Re:Vision Effects for this sort of work -- or I'd do it all in C4D.

CC Power Pin is really meant to fake 3D perspective from 2D, and it has a perspective parameter to adjust the degree of non-linearity in the warping. If I had to tackle this in Ae, I'd probably spend a couple hours on the math to simplify setting the values.

Walter Soyka
Motion Graphics, Widescreen Events, Presentation Design, and Consulting

 Re: simulating per polygon texture mapping in AEon Feb 24, 2015 at 7:48:44 pm

Thanks for that. I've gotten to the point where we're going to have to do this in 3D (C4D as well) or go with after market plugins.
I'll give the revision boys a try. I figure if they can't solve this no one can. We've used their very clever retiming and and tacking software but never their warper.

Thanks