View Issue Details

IDProjectCategoryView StatusLast Update
0002125FSSCPcamera codepublic2010-03-07 09:08
Reporterblowfish Assigned ToWanderer  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.11 
Summary0002125: Camera zooms in and out while panning
DescriptionWhen the camera is panned using set-camera-facing or set-camera-rotation, the fov will zoom in and back out while the rotation takes place. The amount of zoom seems to depend on how far it is rotating, but for wide pans, the graphics will distort considerably because of the extremely low fov this effect causes.
Additional InformationBlue Planet's missions "Ceremony" and "Universal Truth" demonstrate this problem well.
TagsNo tags attached.

Activities

Wanderer

2010-02-27 15:03

developer   ~0011718

Can some one provide simplified mission showing this issue?

blowfish

2010-03-02 02:33

reporter   ~0011733

Okay, I attached a mission that demonstrates the problem well. Two seconds into the mission, the camera rotates to face a ship that is almost behind it. I used set-camera-facing-object in this case, but any type of camera rotation exhibits this problem.

2010-03-02 02:33

 

cameratest.fs2 (6,151 bytes)

Aardwolf

2010-03-03 01:16

reporter   ~0011734

I've figured out the problem, but I haven't quite got a solution.

The camera orientation is stored as a 9-component array (3x3 matrix) of type avd_movement, called "ori" (on line 47 of camera.h)... as far as I can tell, this means that each component of the rotation matrix is being interpolated (in parallel) between the values of the initial and requested rotation matrix. So the rotation matrix "ori" is a linear combination of the two valid matrices (the initial matrix and the final matrix).

Problem being, a linear combination or interpolation of two orthonormal matrices (i.e. rotation matrices) is not going to be another orthonormal matrix. It'll have some scaling.

I think the optimal solution would be replacing it with a quaternion, for which SLERP (Spherical Linear intERPolation) works fine, and then generating the 3x3 matrix on the fly.

Alternatively, the matrix could be re-normalized, but I'm not sure whether that would produce as good results.

Wanderer

2010-03-04 16:54

developer   ~0011743

I tested placing 'vm_orthogonalize_matrix(&c_ori);' after the matrix ops in camera.cpp line 475. Seems to work ok.

Wanderer

2010-03-04 20:32

developer   ~0011747

Fix committed. Please test it in as many ways as you can. Post r5992 trunk builds.

blowfish

2010-03-05 02:43

reporter   ~0011750

The zoom issue appears to be fixed. However, it seems (though someone else will have to confirm this) that acceleration behaves strangely, in that the camera is accelerating throughout the whole turn, regardless of acceleration values. I'm not sure if this is related or not.

Aardwolf

2010-03-06 05:01

reporter   ~0011752

If you mean angular acceleration, I suspect it's because we're still dealing with linearly combined 3x3 matrices, just now we're making sure to fix the scaling problem.

Sort of like if you measured the angle from a fixed point to a point moving at a constant speed...

Wanderer

2010-03-07 09:08

developer   ~0011753

Resolved as per the bug description (fov issue). The problems with accelerating rotation with camera are separate case (more like feature than bugfix if you look how the camera was setup).

Issue History

Date Modified Username Field Change
2010-02-14 01:28 blowfish New Issue
2010-02-27 15:03 Wanderer Note Added: 0011718
2010-03-02 02:33 blowfish Note Added: 0011733
2010-03-02 02:33 blowfish File Added: cameratest.fs2
2010-03-03 01:16 Aardwolf Note Added: 0011734
2010-03-04 16:54 Wanderer Note Added: 0011743
2010-03-04 20:32 Wanderer Note Added: 0011747
2010-03-04 20:32 Wanderer Status new => assigned
2010-03-04 20:32 Wanderer Assigned To => Wanderer
2010-03-04 20:32 Wanderer Status assigned => feedback
2010-03-05 02:43 blowfish Note Added: 0011750
2010-03-06 05:01 Aardwolf Note Added: 0011752
2010-03-07 09:08 Wanderer Note Added: 0011753
2010-03-07 09:08 Wanderer Status feedback => resolved
2010-03-07 09:08 Wanderer Resolution open => fixed