# Optimal Animation

3 replies [Last post]
Lavender81
Offline
Joined: 2006-02-17

On a scene graph, there is about 1000 TransformGroups on which hing 1000 spheres. Within a loop, the position of these 1000 spheres is re-calculated (approx.10,000 times)to produce some sort of animation. What's the optimal way of re-positioning the spheres? resetting their transfor3Ds ? Using an interpolator ? ...

Lavender81
Offline
Joined: 2006-02-17

The system is a quasi-particle system. That is, the spheres do NOT own properties of mass, velocity,...etc. The only property they posess, is their position on the virtual universe. For that each sphere has its own position which differs from its partners, I cannot go about reducing the number of transform Groups (and hence # of tranform3D's). And since the spheres need not change their positions cyclically, I'll exclude the interpolator solution to my poblem. This leaves out the exaustive re-setting of transform3D values solution ?

Anonymous

I had a similar problem. I solved it by generating all the sphere geometries individually into a large float[], while maintaining the indexes into each sphere so I could manipulate their position and scale, then using the array as data for a call to setCoordRefFloat for a single Shape3D. Much like you would approach a particle system, but with spheres.

I was using 1200 spheres with 16 divisions (2,764,800 floats 16*16*9*1200) and the performance was pretty good, but I was also updating a color array for the vertices and each sphere was pretty inefficient because I was using individual triangles instead of strips because I needed to be able to blow the spheres appart as well. If you don't need access to each triangle you can save alot of data and gain faster rendering using triangle stips. A nio buffer can also be used because its all a giant array reference.

Alessandro Borges

Is this a particle system ? In this case, did you check the J3D.org example ?

>What's the optimal way of re-positioning the spheres?
Depends on what you plan. The ideal is to minimize the number of transformGroups and/or transform operations. On some systems is possible to use a few transforms, and others not.

>resetting their transfor3Ds ?
Why not just update the transform3D ?

>Using an interpolator ?
If your event is time based or cyclic (I mean : use Alpha) a interpolator can help you. Of course you can write your own behavior without using interpolators...

Alessandro