DapperDave

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:


return Matrix.CreateLookAt(cameraPosition, cameraLookAt, -up) * Matrix.CreateScale(Zoom);
I created my Orthogonal camera projection like this:

Projection = Matrix.CreateOrthographic(ScreenWidth/100f, ScreenHeight/100f, 0.0f, 4000.0f);
DapperDave
  • Сообщения: 14

Harald

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

Harri
  • Сообщения: 3350

DapperDave

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.
DapperDave
  • Сообщения: 14

Harald

Sorry to hear that it didn't actually save you any time. Anyway, glad to hear you've figured it out! :nerd:
Аватара пользователя
Harald

Harri
  • Сообщения: 3350


Вернуться в Runtimes