-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Animated view transforms R and T #54
base: master
Are you sure you want to change the base?
Conversation
Oh man, this is super smooth! Will have a close look later. |
A little less jarring ... |
I think this is all done now. Key A aligned view position and up vector to nearest axes and key Z resets zoom to bound selected geometries. View changes and focus point reselection now smoothly animated. |
That's slick indeed. I couldn't resist tinkering with it (#56) |
Glad you like it. I guess its OK to change to a time based animated transform. Displaz appears to adjust the amount that is drawn each render in order to preserve some minimum frame rate (and hence responsiveness) - so perhaps it doesn't really matter. |
I think it probably makes sense to use a time-based animation. Nigel's patch also seems to fix some problems which occur when I click around very quickly (before the previous animation has finished). We should definitely ensure robustness to the user doing "stupid things" like clicking during an animation or pressing camera keyboard shortcuts during a camera animation. |
Usability testing (using Nigel's branch): I played with this for a couple of hours using medium sized datasets (~30e6 points). From a raw usability viewpoint I think there's still a few things to do here.
|
src/view3d.cpp
Outdated
m_camera.setCenter( (1 - xsi)*m_animatedViewTransformStartCamera.center() | ||
+ xsi *m_animatedViewTransformEndCamera.center()); | ||
m_camera.setRotation( (1 - xsi)*m_animatedViewTransformStartCamera.rotation() | ||
+ xsi *m_animatedViewTransformEndCamera.rotation()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use proper spherical interpolation with QQuaternion::slerp()
as a matter of general principle. (Not really noticeable unless you're doing large rotations, but may as well.)
General comment on the code: I suspect the camera animation details really belong in a separate object, not in
|
* Increase frame rate in an attempt to keep things smooth and non nausea-inducing for larger data sets. (Or should we do this only during an animation?) * Improve interpolation curves to use slerp() for angles and exponential scaling for radial distance. * Ensure quaternions passed to InteractiveCamera are always normalized
I've done a few of the usability hacks mentioned above on top of Nigel's branch, and pushed it to my axis_alignment branch (see 8661752). |
Cool thanks a lot, this is definitely improved. In terms of key shortcuts, I'd like to keep the number of distinct keys used small if possible. In the current version, the camera rotation animation (with R) still fights the mouse if the user tries to rotate during the animation. |
Extra thought: double clicking in the "data sets" window centers on the given data set. We should connect this to the camera animation as well. |
Extra extra thought: If we have animation in the camera itself (or on a CameraAnimator class as suggested above) that makes it easy to ensure that all repositioning of the camera other than direct click+drag goes through the same system, with consistent animations applied. |
Thought I had solved the fighting - will have another look. Ok with you if I work on building a camera animation class? |
Sure, go for it. Then we can rip most of the new logic here out of view3d.cpp. By the way, I'm a bit inconsistent about file name capitalization. I'm trying to clean up my act: I've started putting new classes - which are nontrivial enough to go into their own file - into source files which are named exactly the same as the class itself. Hence CameraAnimator.h in this case I guess (or think of a more appropriate name.) |
Didn't create a new class CameraAnimator - I felt it was more logical that the animation code was part of interactivecamera class. The setCenter and setEyeToCenterDistance slots can probably be removed as this data is passed in through m_camera.beginAnimateViewTransform(...) The setRotation slot is only used once in mainWindow.cpp - do we really need this call? Presently still using slots in view3d to toggle camera modes. Should we connect these directly to the camera in mainwindow.cpp? I think this would be neater. |
Connected signals from main window menu items (trackball and animation) directly to interactivecamera slots. Also did a bit of tidying and name simplifying. |
I'd suggest not driving the animation with a timer. If there are other redisplay events in play, the animation won't be smooth. It's the redraw itself that ought to be applying the animation based on the current timestamp. I played with putting View3D into a "continuously redraw" mode (AKA idle func) but I wound up with interactions between incremental drawing, mouse interaction and applying animations. I guess I can give it another try when I next book into Linux. |
Yes, it makes sense to drive the animation with a timer, but use a timestamp to compute the value of the animation curve parameter. It may be time to consider taking control of the main Qt event loop ourselves, though I'm not sure it provides any real benefit in this case over a On another note, I think parameter modifications I did to the target frame rate made it smoother, but definitely increased shimmering. I'll have to look at that again before this is merged. |
Oh, the shimmering was due to the target frame rate change? I think there is a bit of a problem if the rate of mouse events (screen and mouse DPI dependent!) resemble the redraw rate. On my machine, the shimmering was pretty severe. I was thinking of disabling incremental rendering while a mouse button is held, but that didn't seem to resolve the problem entirely. |
I think there's a few issues which cause shimmering:
|
Does the problem of shimmering need to moved to a separate issue? I think it is independent of the animated view transforms - when I keep the mouse button down and rotate I get some shimmering, but there are no animated transforms happening during the rotation process. If you are happy with the view alignment functionality and animated transform code then perhaps these should be pulled in and a separate issue raised for shimmering. |
Agreed that it's a separate issue to solve the shimmering problem. However, I'd like to avoid making it worse. |
I'm working on it now - give me an hour and I might have a new commit. |
Using state machine for draw process with incremental timer (now called m_drawTimer) running continuously. Have made it so during mouse rotates only the first frame is drawn each time. Now I get no shimmering. Let me know how it goes for you. I found the shimmering seems to be caused by incremental draws during mouse rotate. |
Only had time for a quick look. I'm still seeing some issues
|
There must be something different about your system. For me, holding the r, t or z buttons causes transformation once and then it finishes the draw and then all quiet. Also r, t, z do not fight mouse movement. However z and mouse wheel do fight. |
Sorry for the silence Greg, I definitely intend to get back to this. The reason I haven't merged it yet is that it's a rather big change to the feel of the user interface, and I really want to get it right. |
I gave this a quick spin on Windows 7 with Intel graphics. Unfortunately there is a noticable flickering at startup, before any data set has been loaded. I'll take a closer look to see if it's something easily fixed. |
Try this. Pressing T merely rotates view to top. Pressing R rotates view to top, and centers and zooms on bounding box for selected geometries. View transforms animate in 10 frames and the incremental draw is not performed until the final frame. Will look at snapping view positions next. Currently left click and mouse move rotates. And with ctrl+ it moves cursor instead. Do we still need this functionality or can we use the ctrl modifier while rotating to perform the snapping? Not sure it makes sense to use a letter + rotate ...