Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: Problem with camera roll  (Read 13819 times)

wallyrut

  • Newbie
  • *
  • Posts: 6
    • View Profile
Problem with camera roll
« on: December 03, 2016, 02:12:07 pm »

When positioning the camera with Enable Roll un-checked, the camera does not appear to have any roll in the display or render, but if I double click the camera, the PYR properties show roll. This appears to be ignored by Anim8or in displaying the scene or rendering, but it is exported in the .an8 scene file. I discovered this because I am writing an exporter in Python to export Anim8or scenes for rendering in appleseed, and after converting the camera orientation quaternion to a 4x4 matrix, sometimes I would get a render with everything looking ok except the scene was rotated around the camera optical axis. If I set the roll to zero in the PYR entry field of the camera properties dialog before saving the file, the scene renders in appleseed with correct camera orientation. I also wrote a Python method to take just the camera z-axis and compute a camera pose matrix with y axis up. If I export the scene without zeroing the camera roll, I can convert the camera orientation quaternion to a 4x4 matrix forcing the y axis up, and then the orientation is good, so apparently the camera orientation quaternion has the z-axis correct, but it is including the unwanted roll.

Wally
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2124
    • View Profile
Re: Problem with camera roll
« Reply #1 on: December 03, 2016, 04:18:41 pm »

Internally the camera orientation is interpolated according to the quaternions in the keys. I think this is what you are seeing. But after that if roll is not enabled the camera is "unrolled" to keep it upright. The resulting value is what you want, I think. I'll look into fixing this.
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2124
    • View Profile
Re: Problem with camera roll
« Reply #2 on: December 03, 2016, 08:24:09 pm »

A bit more on camera orientation:

The values displayed in the Camera Parameters dialog are the result from converting the quaternion into 3 consecutive rotations: pitch (X), yaw (Z) and then roll (Y), so zeroing the Y component eliminates the roll. (Your code works for 2 of the 6 orders that they can be applied.)

Note that the orientation is relative to the camera's parent. When it's parent is the world then the orientation is in world-space, and your code will work. However if the camera is a child of another object the you'll need to take that into account as well.


Logged

wallyrut

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with camera roll
« Reply #3 on: December 07, 2016, 02:36:40 pm »

Actually the rotation order is not an issue for me, as I'm using the camera quaternion to get the camera z-axis and computing the  matrix from that, so I never deal with the rotation angles. The only problem case is if the camera is pointed vertically, when rotating it upright is not uniquely defined.

Wally
Logged