How to to transform a polygon to its mirror image

Started by
2 comments, last by haegarr 10 years, 1 month ago
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?

Thanks in advance
Advertisement

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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

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.

This topic is closed to new replies.

Advertisement