Jump to content
  • Advertisement
Sign in to follow this  
spowers

Image distortion when view matrix is re-oriented

This topic is 822 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

I'm witnessing some image distortion when the view matrix rotated around the camera's Z axis.

 

If I set a projection matrix with aspect ratio of 2:1 and then rotate the camera about the Z-axis I notice a bit of stretching as the camera is rotated. The projection matrix is never changed but the view matrix is modified directly. The only thing being manipulated is the rotation (no transform or scale). The viewport is also constant.

 

 

Is this a normal side effect of graphical rendering?

How can this be avoided?

Should I be rotating the projection matrix instead of the view matrix?

Share this post


Link to post
Share on other sites
Advertisement

What projection matrix do you use, perspective or orthogonal projection?

 

In case of perspective projection matrix, ratio of 2/1 will couse different depth/distance from perspective camera in any rotation by view direction.

 

Perspective matrix naturaly deforms everything, even if objects are straight. You either use orthogonal projection for exact observing, or you can set ratio to 1/1 of perspective matrix, and when you rotate by view vector, objects should stay as they perspectively are.

 

Share this post


Link to post
Share on other sites

I'm using a perspective projection. I agree there should be some distortion but the distortion I'm experiencing is extreme. I've attached an image to demonstrate. You can see the distortion in the clouds and on the ship. The only thing that has changed between the two images is a rotation applied to the view matrix.

Share this post


Link to post
Share on other sites

Nevermind, I found the issue. The Perspective was not getting set correctly. Its aspect ratio did not match the viewport which caused the stretching. Small little piece of code that was changing it without my knowledge each frame.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!