Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with Rotating Texture on Sphere.

Da5id Zsigmond
Registered User
Join date: 26 Jan 2007
Posts: 34
08-11-2007 08:52
Hi - just making a model of our little planet and would like to rotate the texture so it appears to be revolving.

I have a texture which when applied to a sphere looks good - not perfect because the original texture is a rectangle - but pretty good. North/South axis is correct.

HOWEVER,
When I use SetTextureAnim - ROTATE|SMOOTH| etc. the texture rotates around either the x or y axis not the Z so the effect is of a planet rotating around the equator not the poles.

When I use SetTextureAnim to change the start angle on the texture it always seems to rotate around the X or Y axis - the axis is still left to right or front to back - which looks kinda odd.

I've tried changing the texture angle but it always seems to change in the same plane -
I've tried rezzing the sphere - rotating that and then applying the texture - no luck.

Thinking about exporting the texture - rotating it 90degrees in photoshop and seeing if it then rotates around the poles.

Any input on how textures get mapped onto spheres would be greatly appreciated.

Using Texture animation seems like a much less laggy way to go rather than rotating the whole prim to get the effect - which looks like the only way right now.
Chip Midnight
ate my baby!
Join date: 1 May 2003
Posts: 10,231
08-11-2007 09:27
You don't want to animate rotation on the texture, you want to animate offset values along the horizontal axis. That will give you the look of rotation on the polar axis.
_____________________

My other hobby:
www.live365.com/stations/chip_midnight
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
Using psp and animation shop?
08-11-2007 09:42
Ive created textures that i want to rotate, seamlessly.. ie the edges match the start of any edge, so the cycle is continuos, no start no finish..

I used psp and animation shop to create a seamless texture..

lets suppose it is an atmosphere of the the earth, beneath it can be seen continents..

you want to clouds to move with the rotation, so use something like animation shops underwater effects and swirl rotations.. it would take you some time to learn that if you have never used it before, the temptation is always to create a dramatic effect, when what one really needs is something very subtle and gradual.

The point i am getting to, is it is possible to create say, an 80 frame texture... that is in effect an animated planet atmosphere, beneath which in the same 80 frame anim, the continents turn..

The sphere doesnt rotate at all, its the texture thats cycling.. of course adding a rotation to the sphere can create a very different effect, the atmosphere texture turning clockwise..the sphere turning anticlockwise for example..

The script to animate the texture, this one cycles texture animations.. i create several animations based on the same texture and cycle them.. on can randomise that too, (something to consider) lets suppose one has three or four texture anims based on swirling clouds.. each one starts with the same start frame, but is different then on up to nearly the last frames.. and ends with the same last frame as the others.. so. one gets variety with constant change.
you need to put the texture in the objects inventory..


integer max_nr;
integer cur_nr;
integer time = 5; //write here your time


init()
{
max_nr = llGetInventoryNumber(INVENTORY_TEXTURE);
cur_nr = 0;

llSetTimerEvent(time);
llSetTextureAnim( ANIM_ON | LOOP , ALL_SIDES, 4, 4, 0, 16, 17); // this is a 4 by 4 (16 frame texture) starting at frame 0 finishing at frame 16, at a 17 ms per frame
}

default
{
state_entry()
{
init();
}

changed(integer change)
{
if (change & CHANGED_INVENTORY)
init();
}

on_rez(integer param)
{
init();
}

timer()
{
cur_nr++;
if (cur_nr == max_nr)
cur_nr = 0;
llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, cur_nr), ALL_SIDES); //change ALL_SIDES to side nr. if you want
}
}



The script that rotates the sphere.. any angle x y or z, or all at the same time..

default
{
state_entry()
{
llTargetOmega(<0,0,0.03>,PI,1.0); // 0.03 shown here is the time, for that angle
}

}
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
08-11-2007 09:46
Icony's answer is correct, of course, but it's way over complicated, in my opinion, given your question, Da5id. As Chip was hinting at, the simple animation of a texture around a sphere will always go around the sphere's local X axis. Turn on wireframe view, and it's easy to see why. X is the sphere's polar axis, not Z or Y.

You can still make the texture appear to rotate in any direction you want though, just by rotating the sphere itself. If you want the polar axis to be horizontal, set the shpere's X & Y rotation zero, and set Z to anything you want. If you want the pole to be vertical, go with a rotation settig (0,90,0). It's pretty simple.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Da5id Zsigmond
Registered User
Join date: 26 Jan 2007
Posts: 34
Thanks muchly
08-11-2007 10:23
I had a feeling that it was actually simple once I had my brain rotating in the right plane.
It hadn't occurred to me to try the offset.

Thanks a lot for the help -

Once I have it up I'll post an LM so folks can see it.

Da5id
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
08-11-2007 11:13
just use SMOOTH instead of ROTATE

it will slide the image in a loop from right to left looking like your planet is spinning