Nicros
Nicros

Reputation: 5203

WPF 3D Perspective camera question

I am working on a 3D flip control that can flip horizontally, vertically and can have any size and square or rectangular shape.

While I have it working, I ran into a very odd issue with the perspective camera. When I create a MeshGeometry3D I scale to the proper ratio of the content. If the width > height, all is well. However, if height > width, then the 3d mesh is sized too small.

The only thing that fixed this was (if height > width) change the UpDirection on the perspective camera from 0 1 0 to 1 0 0 and apply a 90 rotate transform. When I do this, everything looks perfect.

Anyone know why this is? Does the perspective camera only take width into account when sizing the mesh?

Thanks!

Upvotes: 1

Views: 1724

Answers (1)

Julien Lebosquain
Julien Lebosquain

Reputation: 41253

Try to play with the FieldOfView property. That's the angle at which the scene is "seen" by the camera. In your case multiplying the ratio by height / width without changing the FoV should suffice.

Upvotes: 1

Related Questions