Public Group

# How to to transform a polygon to its mirror image

This topic is 2036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I am processing video frame and in each frame generating some small polygonal model. As in picture, our right side is shown as left side and vice versa. But I would like to keep the right side of person as right side in picture and same while generating polygonal model. I know it involves some matrix transformation. Could anyone provide me suggestion about how to proceed?

##### Share on other sites

Flip about any given axis by inverting the axis.

1 0 0 0    -1 0 0 0
0 1 0 0 --\ 0 1 0 0
0 0 1 0 --/ 0 0 1 0
0 0 0 1     0 0 0 1

This flips around the X axis.

To create the world matrix for the mirrored object, apply row-major matrices in the following order:

AboveMatrix * OriginalWorldMatrix * MirrorTranslateMatrix = MirrorWorldMatrix

Culling must be reversed when flipping a single axis (CW -> CCW and CCW -> CW).

L. Spiro

Edited by L. Spiro

##### Share on other sites
Thank you very much for the suggestion. Suppose when we display image, we paste the image along the texture coordinates i.e. 00, 01, 11, 10. Now how to map the texture so that image is displayed as mirror image in a plane.

Thanks

##### Share on other sites

Texture co-ordinates are interpolated any way, so if (u,v) sequence (0,0), (0,1), (1,1), (1,0) denotes the left-to-right texel ordering then (1,0), (1,1), (0,1), (0,0) denotes the right-to-left texel ordering. When the vertex positions are left as they are, then the image will be displayed mirrored over x.

EDIT: Notice that you can leave the vertex positions where they are and change the belonging texture co-ordinates as shown above, or else change the vertex positions (e.g. as shown by L. Spiro) the but without changing the value of belonging texture-cordinates. If you do both, i.e. mirror the positions and change the texture co-ordinates, then the resulting image will visually not change because you've mirrored forth and back.

Edited by haegarr

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 18
• 34
• 9
• 16
• 22