Difference between revisions of "Animation Streamlined"

From Second Life Wiki
Jump to navigation Jump to search
Line 72: Line 72:
* It generates a LOT of viewer lag. The viewer receives a message for each prim change. The viewer recalculates the sculpt mesh with each change.  Consider hidden prims in your creature showing the next "frame" or having a flock out.
* It generates a LOT of viewer lag. The viewer receives a message for each prim change. The viewer recalculates the sculpt mesh with each change.  Consider hidden prims in your creature showing the next "frame" or having a flock out.
** The impact of the recalculating can be softened by having prims within loading range showing the same sculpt shapes
** The impact of the recalculating can be softened by having prims within loading range showing the same sculpt shapes
** If the sculpt map texture isn't currently in the scene, it may be removed from the viewer's cache, so it may be end up being sent to the viewer multiple times. The blue-outlined cube behind the pigeon has the sculpt map textures on its sides.
** If the sculpt map texture isn't currently in the scene, it may be removed from the viewer's cache, so it may be end up being sent to the viewer multiple times. The blue-outlined cube behind the pigeon has the sculpt map textures on its sides, so the viewer doesn't remove them from the cache while the bird is in sight.
* Use [[LlSetLinkPrimitiveParamsFast|llSetLinkPrimitiveParamsFast]] with the [[PRIM_TYPE_SCULPT]] flag to set a prim's sculpt map.
* Use [[LlSetLinkPrimitiveParamsFast|llSetLinkPrimitiveParamsFast]] with the [[PRIM_TYPE_SCULPT]] flag to set a prim's sculpt map.

Revision as of 10:29, 13 June 2012

Animating Streamlined

Your creations are on the move. Congratulations!

What? Now you want their wings flapping and their legs moving?

How do I choose?

You've got some choices to make. All the methods described here involve tradeoffs, and no one method is best in all situations.

They work with pathfinding-enabled and non-pathfinding creations.

Method: Animated Textures

Animated hippofly.gif

Use llSetTextureAnim and llSetLinkTextureAnim with a texture to simulate movement.

Most of the time a framed texture is what you'd want, but for something like a millipede's legs you might want to use a tiling texture instead. Here's a 2x2 framed texture next to a picture of it animated.

Eye Frame.jpg Eye Frame.gif

  • This is very low server and viewer lag.
  • This is 2D, so it's best for small or flat things.
  • SL won't allow you to upload a texture larger than 1024x1024 pixels so resolution may be an issue for textures with a lot of frames.
  • Animated textures on a prim can be on one face, or all faces with one direction, so sometimes you have to break a moving section up. (point out Sylvan's flipped UV wheel trick here)

The hippo flies are an example of using model design and animated textures together. The model has several sets of wings. The different frames of the texture each have one pair of wings visible, so when animated the hippo flies seem to flap their wings. Mesh models don't look glitched like a sculpt does when a texture with transparency is applied.

Method: Flexible Prims

Animated flexibird.gif

Flexi can be used to simulate smooth movement. Sadly, I couldn't capture how smooth it looks using snapshots.

  • A large number of flexi prims in a scene can lag the viewer. Viewer graphic settings can impact how flexi prims are displayed.
  • A flexi prim's values can be set in the edit window or changed via script using llSetLinkPrimitiveParamsFast and the PRIM_FLEXIBLE flag.

Method: Alpha Animation

Animated ray.gif

Use llSetLinkAlpha to change which pieces are visible at any one time to simulate movement.

Make several models of your creature in different poses. Link them together, usually at the torso. Alternate which model of the linkset is visible.

  • Higher LI/prim count than other methods.
  • It induces less server lag than moving the prims, but the viewer receives a message for every alpha change.

Method: Prim Movement

Animated bunny.gif

This method repositions and resizes pieces to simulate movement.

Method: Sculpt Map Swap

Animated flock.gifAnimated pigeon.gif

Swap the prim's sculpt map to simulate movement.

  • Lower LI/prim count than alpha animation. Beware of LI when using sculpts!
  • It generates a LOT of viewer lag. The viewer receives a message for each prim change. The viewer recalculates the sculpt mesh with each change. Consider hidden prims in your creature showing the next "frame" or having a flock out.
    • The impact of the recalculating can be softened by having prims within loading range showing the same sculpt shapes
    • If the sculpt map texture isn't currently in the scene, it may be removed from the viewer's cache, so it may be end up being sent to the viewer multiple times. The blue-outlined cube behind the pigeon has the sculpt map textures on its sides, so the viewer doesn't remove them from the cache while the bird is in sight.
  • Use llSetLinkPrimitiveParamsFast with the PRIM_TYPE_SCULPT flag to set a prim's sculpt map.