I have been on sabbatical from this blog because I am trying to track down a problem.

I have an image that I want to take a portion of (an interior, randomly shaped clip mask) and fit that clipping to another shape, and I need to automate it.

Sounds easy, right?

Ok, a more full description of the problem is:

I am trying to take a portion of an image from Photoshop and bring it to fit a UV map in LW. I am able to get an alpha cutout of the image easily, making the UV map in Lightwave is simple as you can get, the UV map comes into Photoshop or Illustrator (or any other program) simply enough, and it is simple to produce an alpha mask of it. The crux is that there is no relation between the shape of the image alpha map and the UV map, and neither one is consistently shaped from object to object or image to image.

The LW objects to be mapped are all one 1/2 of a 2-sided shell (that is, topologically similar to a half sphere). None of the objects have the same number of points or polys.

Those are the variables. . . the goal is to have the non-alpha portion of the image exactly fit the UV map of the objects. I am open to any options that involve morphs as well.

So the first thoughts were obvious: Use Photoshop! Didn’t work, so use Illustrator! Didn’t work, so use Inkscape, Gimp, Imagemagick, theoretical papers on shape matching for visually aware robots (I am not that far along yet. . .). I am considering the huge leap to program this in C++, but I want to avoid this for obvious reasons.

Adobe Illustrator has the “Envelope Distort”. These are the docs on that function’s options:

http://help.adobe.com/en_US/Illustrator/14.0/WS714a382cdf7d304e7e07d0100196cbc5f-6463a.html

But it doesn’t fit a clipping mask correctly . . . or maybe it does, but that feature is what I want it to do, as I am discussing in this forum:

http://www.layersmagazine.com/forum/showthread.php?t=6305

What the Envelope Distort does is fit the bounding box of the image to the shape. I get the same results no matter which envelope distort options I choose. It does not seem to respond to the transparency of a PNG image, nor to a clipping mask. In both of those situations, it defaults to the bounding box of the image again (this seems like a bug, but I have been told it may not be).

Photoshop has distortion tools, but they are manual editing only. That is, in order to fit a specific shape, you have to create a mesh that deforms the input image to the output shape; and you can save that mesh and apply it to other images. The problem is that none of the images I have are identical, nor are any of the shapes I am trying to fit identical. This kind of automation is not possible with Photoshop. Illustrator’s other distortion tools are the same – manual editing is ok, but programming it cannot work; or, because it is Illustrator, work fine and can be automated for vector objects, but not for raster. I have left a post on Adobe’s forum about this:

http://www.adobeforums.com/webx/.59b7a3db

I am attempting to find a solution through Lightwave 3D as well. I have not got a good response yet, but by looking at some of the features, there may be a solution. This is my forum post on Newtek’s forum site:

http://www.newtek.com/forums/showthread.php?t=94316

Inkscape’s (http://www.inkscape.org/) documentation is pretty lousy, even though it is good program overall. Actually, it is still pretty buggy in some places, but it is nice to see a good freeware program for illustration.

Gimp (http://gimp.org) seems somewhat promising, but no luck.
Imagemagick (http://www.imagemagick.org/script/index.php) is a little inscrutable for searching for specific functions, but I’ll keep digging at it.

I am thinking that Blender (http://www.blender.org/) may have some options – and I will be looking more at them – but the results need to be in Lightwave, ultimately. Still, it’s worth a shot.

So if you know how to do this – and it doesn’t need to be Adobe or Lightwave products, but must be programmable – let me know.

– 30 –

Advertisements