View Full Version : Virtual trackball and mouse pos out of the sphere
11-06-2008, 03:55 AM
We noticed that some popular 3D app can smoothly rotate the model even with the mouse out of the virtual trackball sphere (instead of spinning the model around the Z axis coming out of the screen as we all do)
What is the trick behind this?
As you know when the mouse pointer is out of the sphere one of the vector components is zero and the cross product always gives a rotation axis perpendicular to the screen surface.
Thanks in advance,
11-06-2008, 04:00 AM
Turntable versus trackball ?
11-06-2008, 04:18 AM
We have tryed both, but what I see is something still different.
I will prepare a movie to show you what I mean.
11-06-2008, 07:09 AM
Here are the movies:
1) Turntable (hor mouse movements in rotation around the vertical axis and ver mouse movements in rotation around world X axis)
Turntable movie (http://www.devdept.com/turntable.avi)
2) "Smart" trackball - want we would like to achieve - (inside the sphere we know outside we don't)
Smart trackball movie (http://www.devdept.com/trackball.avi)
Do you notice how smoothly the mouse move far in the viewport corner withot making the model to spin?
Please let me know what you think.
11-06-2008, 08:07 AM
I wanted also to add - for a better understanding - that the product I used to make movies, calls
Turntable: rotate around world axes
Trackball: rotate relative to view
In effect we managed to mimic the "Smart trackball" using the turtable approach on camera up and right axis, but unfortunately the model is not stick at the mouse cursor as in the movie provided.
11-06-2008, 10:45 AM
looks like the virtual trackball sphere is scaled up to the mouse pointer when the mouse pointer is outside the default sphere.
11-06-2008, 02:09 PM
Think about it, scaling the trackball would simply keep the mouse position on the sphere edge (circle) always producing a rotation axis perpendicular to the screen.
We also tried to:
1) switch to turntable when outside of the spere but it doesn't look fine
2) use a trackball diameter equal to the viewport diagonal, again with no luck
There is something more that we miss.
11-11-2008, 01:48 AM
Hey guys, any other good idea on this trick?
11-11-2008, 04:57 PM
Sure, here's a random idea. The idea with trackball rotation is you project the sphere to a plane, and then the mouse selects a point on the plane (which corresponds to a point on the sphere), moves it to another point on the plane, and computes the corresponding rotation that maps the first point to the second.
To be able to rotate more than just a hemisphere (all that's visible in the projection from sphere to plane), try a different projection. E.g. Paul Debevec has a full sphere mapping onto a plane for his lightprobe images - he details the math of the projection on http://www.debevec.org/probes/ . If you take your two points on the plane to be points according to this mapping, then you could rotate past the normal hemisphere of trackball rotation.
11-12-2008, 03:33 AM
I don't follow your explanation and I find it difficult also to find a program to downlaod to test this trackball approach.
Please help me further.
11-12-2008, 02:28 PM
It was just a random idea. There's plenty of research on this topic in the 3D UI literature. Check out the paper "Virtual Trackballs Revisited". The authors have code up here:
http://image.diku.dk/research/trackballs/index.html As described in that paper, you probably want a Bell trackball.
11-13-2008, 01:12 AM
I'll take a look to this article and let you know.
11-13-2008, 11:27 AM
It looks like the virtual trackball you want is Andy Hanson's rolling ball" technique. He calls it context free, since you get the same rotation regardless of whether you're in the sphere or not. It does rotation in the x-y plane, but not around z except via a weird side effect that you can read about -- see below).
The technique is described in Graphics Gems III, though the code given is pretty much just an outline. A more thorough explanation can be found in Gems V and in his new book "Visualizing Quaternions".
A working implementation can be found at:
11-14-2008, 07:41 AM
Yes, rolling ball is another intersting approach I will read more about it.
BTW it is not what you see in the movie provided.
11-15-2008, 12:28 AM
I'm currently studying the differences between the most popular virtual trackball algorithms (Chen, Hanson, Shoemake and Bell). So I am very interested in this topic. The only difference I see between your smart trackball movie and Hanson's rolling ball is that the movie doesn't show the precession in Hanson's algorithm (where small rotations cause the entire ball to rotate around the z-axis in the opposite direction).
Could you tell me what other difference(s) you see?
11-15-2008, 05:33 AM
In my opinion the difference is that when the mouse is over the sphere (diameter of the smallest viewport dim) it works like the Shoemake one while out side it work like a rolling ball.
It is quite difficult to merge the two smoothly.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.