How to Flip an Image via the Camera’s Projection Matrix


Sometimes it can be useful to flip an image. One way this can be achieved is by inverting the camera’s projection matrix.  By inverting the projection matrix, all draw calls will apply an inverted projection matrix to the mesh being rendered which will cause the mesh to be rendered upside down.
The script below demonstrates how to do that.

Place the following script on your scene’s camera.

You must remember to invert the culling when inverting the projection matrix. If you don’t, you will get a result like the one below.

The reason for this is because the order in which your vertices are defined will not change when you invert the projection matrix.

The GPU will incorrectly cull your mesh if the winding/culling mode isn’t inverted after inverting the projection matrix.  The above example shows how the winding order should be inverted when inverting the projection matrix.

Download the Example Project

Share It!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.