Oh, sorry if what I said was confusing. I'm using this to convert
*textures* for 3D models, not to render the 3d models.

For instance, if I have two seperate sets of UV coordinates for the
same model, I want to be able to use these two seperate sets of UVs to
translate the texture for one UV layout to work with the other uv
layout. This is totally 2D work, it's just used for 3d stuff.

I.e., for instance, consider the normal way of unwrapping a cube,
where four squares are connected to a central square, and then one
other square is connected to one of those, making a cruciform shape.
Then consider another option wherein the same cube is very badly
mapped, with each square seperately mapped as a square, and one of
them distorted into a trapezoid. This is a very simple case, but easy
enough to mentally illustrate.

Thus I want to be able to take a texture designed for the latter, bad
mapping of the figure and translate it to fit on the former good
mapping. Each square would be repositioned, scaled, rotated as
necessary, and the trapezoid would be undistorted. Of course, rather
than thinking of them as squares, however, I'd be thinking of each
square/trapezoid as a pair of triangles. For square, ABCD, I'd think
in term of triangles ABC and BCD. But the warping owuld only take
place in 2D, not 3D.

Thanks fcor the link to xmorph. I'll look closely at that as soon as I
get where I'm going and back online.

On 3/8/06, Gabe Schaffer <[EMAIL PROTECTED]> wrote:
> > > The problem is most people don't want a linear warp, they want a psuedo
> > > perspective warp, which involves warping four points and trapeziods
> > > rather than triangles.
> >
> > > You can't do that directly with a -affine matrix.
> >
> > Every quad is simply two tris. Any quad can be warped as tris by
> > warping the tri of the first three points, and then warping the tri of
> > the last three points.
>
> Actually, that's not the problem. The problem is that you are doing 3D
> transforms, whereas affine transforms are strictly 2D. For example,
> let's say you have a triangle you are transforming so that the height
> is taller but the base stays the same. With an affine transform, the
> height of each pixel is scaled the same amount.
>
> What you probably need is for the scale factor of each pixel to be
> based on its distance from the base. Let's say the top of the triangle
> recedes into the distance. In that case the top pixels would be scaled
> so they're shorter than the bottom pixels. An affine transform cannot
> do this, but a perspective transform can.
>
> Of course you could always use enough triangles to approximate a
> perspective transform with affine transforms. In that case, I suggest
> looking at the xmorph program on sourceforge (xmorph.sourceforge.net).
> It does 2D warping, and you may be able to use IM to convert between
> your source format and TGA, then use morph/xmorph on the TGA files.
>
> GNS
>


--
Dodger

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to