Advertisement Jump to content
Sign in to follow this  
jenny_wui

How to to transform a polygon to its mirror image

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

If you intended to correct an error in the post then please contact us.

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?

Thanks in advance

Share this post


Link to post
Share on other sites
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

Edited by L. Spiro

Share this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!