• Runtimes
  • Zooming with 3D Orthogonal Camera

  • Изменено

EDIT: This is related to my billboarding attempts I also posted about. I need to test some more things before asking this question.

I've been using a 3D orthogonal camera thus far and have recently implemented spine animations. These animations have issues when my camera zooms and I suspect it has to do with the way I am zooming my camera rather than the spine animations.

You can see yourself how the animated characters become warped when I use camera zooming. Everything else behaves as expected:

For zooming, I just multiply the view matrix by a zoom scale matrix. Someone told me recently that this isn't the correct way to do it:

			[code]return Matrix.CreateLookAt(cameraPosition, cameraLookAt, -up) * Matrix.CreateScale(Zoom);[/code]

I created my Orthogonal camera projection like this:

			[code]Projection = Matrix.CreateOrthographic(ScreenWidth/100f, ScreenHeight/100f, 0.0f, 4000.0f);[/code]
DapperDave написал

For zooming, I just multiply the view matrix by a zoom scale matrix. Someone told me recently that this isn't the correct way to do it:

If I understood that correctly you are using the camera matrix values in calculating your billboard object transformation matrix (on this posting):

ModelMatrix.Up = Vector3.Up;
ModelMatrix.Right = new Vector3(References._3Dcamera.View.Forward.Z, 0, References._3Dcamera.View.Forward.X);

If you now scale your _3Dcamera.View matrix, you will scale the ModelMatrix.Right vector implicitly, but not the ModelMatrix.Up vector. So you could either use a normalized vector of References._3Dcamera.View.Forward, or not scale your View matrix at all.

Typically for zoom effects you would not scale the view matrix, but instead change the projection matrix.

Harald, you figured it out 4 hours before I did. Thanks for remembering my problems in that other post since they turned out to be related.

Sorry to hear that it didn't actually save you any time. Anyway, glad to hear you've figured it out! :nerd: