mapping texture on rolling ball

Started by
5 comments, last by haegarr 14 years, 2 months ago
suppose you have a ball and put texture on it(I wouldn't know how to map texture to a sphere...how do I do that?) and suppose you get the ball rolling in some direction, the texture must of course move also. do I just measure how much space it traveled and do that mod(I mean %) circumference of sphere and find out how much to shift the texture so that it realistically looks like the ball has moved ?
Advertisement
To avoid drastic distortions at the poles, you should construct the sphere using 6 quadrilateral patches (like a cube where the corners are pulled some way to the inside). Then mapping a texture is easy and mostly distortion free.

When rolling the ball, don't animate that by changing the texture mapping. Instead, change the local co-ordinate frame of the ball and let the texture fixed.
Quote:Original post by haegarr
To avoid drastic distortions at the poles, you should construct the sphere using 6 quadrilateral patches (like a cube where the corners are pulled some way to the inside). Then mapping a texture is easy and mostly distortion free.

When rolling the ball, don't animate that by changing the texture mapping. Instead, change the local co-ordinate frame of the ball and let the texture fixed.
I agree with that. And I guess that requires cube-map texture. Am I right?
Quote:Original post by szecs
I agree with that. And I guess that requires cube-map texture. Am I right?
At the end, yes. However, whether one uses 6 single textures, 6 textures that are packed into a specialized cube map, 1 texture with 6 fields, or 1 texture with 1 field that is repeated, is freely chooseable. Using regular texture mapping allows to optimize texturing to further hide distortions at the patch's corners, if wanted.
ok and should I map texture from cube to sphere like this ? if you notice , the texture at the corners is distorted comparing cube to sphere ...
if I do how you recommend to make 6 patches out of it(and that's because of some property of the sphere which we learned at differential geometry and I forgot how it's called, it had something to do with projections I think ... maybe this ?) then I have to find which portion of the texture I should use so that it's mapped correctly by trial and error maybe
Quote:Original post by haegarr
change the local co-ordinate frame of the ball and let the texture fixed.


how do I do that ?

The first link gives you a prescription of how to compute the vertex positions of such a sphere when a cube is given. It is for sure a nice page and you can use it (assuming that the math shown there is correct). Notice please that the distortions at the "corners" are very less noticeable compared to the distortions you'll get when having a sphere mesh with poles!

As I've mentioned in my previous post, you can try to predistort your texture mapping so that the geometrical distortions are even less noticeable. I.e. project a single patch onto a plane (in a way that depends on the chosen texture mapping), and use an image of that projection in the background when drawing the texture image. Then you'll see where the texture will be squeezed or stretched, and hence can adapt the drawing accordingly.

If you don't know what a local co-ordinate frame is then you'll get a hard time to animate a ball. Please look out for the keywords "forward kinematics" and "co-ordinate frame", e.g. here on GDnet and the internet at all (but you should restrict yourself to pages not going too deep into the math). In short, a frame defines a co-ordinate space inside another co-ordinate space. In your case you'll define a ball-local space wherein the mesh and the texture mapping is always fix. But you relate the ball-local frame to the world (i.e. the global frame). When changing the relation (i.e. the position and/or orientation) of the local frame over time you yield in an animation of the ball that is able to simulate rolling.

You've mentioned it already in the OP: When the ball is rolling, the path length of the ball on the ground and the length of the arc where the ball touches the ground during rolling has to be the same. So, for a given piece of way you can compute the translation of the ball's center as well as its rotation, and apply that as transformation to the local frame.

This topic is closed to new replies.

Advertisement