gib

03-16-2003, 10:34 PM

I want to draw an image (using texture mapping) in a certain way that distorts the image. For example: take a square and squash the sides together at the top, giving a trapezium that has parallel top and bottom sizes, but the top side is shorter than the bottom. I want to map a square image onto this quad, in such a way that there is no distortion in the Y direction, but a scaling in the X direction that varies with y.

Mathematically it is something like:

-1 <= x <= 1, -1 <= y <= 1, 0 < a < 1,

and the mapping is (x,y) -> (x',y')

where

x' = x*((a-1)*y + a+1)/2

y' = y

(The top of the trapezium has -a < x' < a).

I have found that splitting the image up into

triangles (or quads) requires a large number of faces to avoid ugly effects. What happens is straight lines in the image become kinked. Using tex mapping in the usual way, it seems to be impossible to avoid this kinking, all you can do is make the triangles so small that the kinking becomes unnoticeable.

Is there a better way to do this?

Gib

Mathematically it is something like:

-1 <= x <= 1, -1 <= y <= 1, 0 < a < 1,

and the mapping is (x,y) -> (x',y')

where

x' = x*((a-1)*y + a+1)/2

y' = y

(The top of the trapezium has -a < x' < a).

I have found that splitting the image up into

triangles (or quads) requires a large number of faces to avoid ugly effects. What happens is straight lines in the image become kinked. Using tex mapping in the usual way, it seems to be impossible to avoid this kinking, all you can do is make the triangles so small that the kinking becomes unnoticeable.

Is there a better way to do this?

Gib