Carsten,
As part of my groups work with OpenSG, we have written an animation library
for OpenSG 1.8. From what you have described, a port of this library to
OpenSG 2.0 could be useful.
Some overview of the features:
Everything is a part of the OpenSG Field/FieldContainer system. All of
the new functionality was created using .fcd files to generate these new
types as proper OpenSG field containers.
KeyframeSequences - derived from AttachmentContainer
Most of the useful types have Keyframe sequences defined for them: Pnts,
Vecs, Matricies, quaternioins, ints, reals, colors, even FieldContianerPtrs.
Interpolations defined:
step, linear, and cubic
this includes using slerp and sqaud for the linear and cubic
interpolations of quaternions
Value replacements:
animations can replace the value of the value being animated either
by overwriting it(most common), adding to the value, or adding to the value
the difference since the last update.
Animator - derived from AttachmentContainer
Animators hold a pointer(FieldContainerPtr) to a keyframe sequence.
Used to apply a keyframe sequence to an animated value
Animation - derived from AttachmentContainer
FieldAnimation - derived from Animation
contains:
An AnimatorPtr for applying some animation
A FieldContainerPtr to the FC to animate
A FieldID of the field to animate
The interpolation type, and replacement type to use
This allows us to define a keyframe sequence on colors, Pnts,
matrices, etc and then connect those as an animation to any field of a
FieldContainer that matches the type of the keyframe sequence.
We have used this to animate Transform cores, colors in
materials, and even uniform shader attributes on a ShaderParameter*Ptr field
container.
The FieldAnimation can also apply an animator to a specific
index in a MField, again as long as the types are the same.
BlendedGeometry - inherits from Geometry
Has a Base Geometry and any number of "blend" geometries. A weight can
be attached to each blend geomtry to dictate the influence on the final
geometry.
Animating the blended geometry is then as simple as attaching a
FieldAnimation to the weight multifiled.
These are very similar to blend shapes in Maya.
AnimatedCharacters
Joints - essentially transformations
Skeletons - Joint hierarchy
SkeletonBlendedGeometry - inherits from Geometry
defines wieghting between vertices in a geometry and joints in a
skeleton
SkeletonAnimation - inherits from Animation
Holds a collection of Joint animations and a
SkeletonBlendedGeometry to apply the animations to. It is optimized to only
update the verticies once per update.
SkeletonBlendedAnimations - inherits from Animation
Holds a collection of SkeltonAnimations and weight for all of them.
This is used to seamlessly blend between a walk and run animation
by changing the weights.
AnimationAdvancers
We found that we do not always want animations to be directly tied to
an elapsed time update.
So we made animation advancers that can advance an animation. The most
comont one is the advancer that updates an animation based on the elapsed
time since the last update. We also made an advancer that updates an
animation based on the value of any field that is a Real32. We have used
this to define an animation that changes the color of a material by updating
an animation based on the distance from the camera beacon to another node.
This has also been used to slow or increase the speed of an animation
without having to change the underlying key values in the keyframe sequence.
On Sat, Aug 1, 2009 at 10:27 AM, Carsten Neumann <[email protected]>wrote:
> Hello Gerrit,
>
> I really would like to see only one instance in there.
>>>>
>>> sure, that is fine with me. Can you give a description of the parts of
>>> that system and what roles they play?
>>>
>>
>> basically they all follow the VRML/X3D model. You have your time sensor
>> and interpolator elements and connect the via field connectors (aka
>> routes). Let me take this part out of the CSM dir where it lives right
>> now and repackage this into a separate contrib dir to untangle things a
>> little.
>>
>
> hm, the interpolators unfortunately combine the constant data for the
> animation with the changing data for playback. That means if I need to play
> the same animation (started at different times) for two different characters
> I need to duplicate the whole keyframe data, or am I missing something ?
> That is why there is the difference between an AnimationTemplate (with
> ATracks) and an Animation (with AChannels), one just stores data, the other
> is a "cursor" into that data - similar to how Cal3d splits things with its
> Core and non-Core types.
The library I have written supports just this type of arrangment.
>
>
> We specifically need to handle key frame animation for vertex skinning for
>>> characters. Any hints how existing parts are best used/extended to support
>>> that are also very welcome.
>>>
>>
>> If you can work with the std vrml/x3d interpolators
>> (IIRC pos/scalar/ori/coordinate), which I hope as skin+bones are in
>> both, the basics should all be there.
>>
>
> yes, a bone is essentially just a coordinate system. One thing to consider
> though: there is often more than one animation applied to a skeleton. For
> that case you need to accumulate all input for one bone in some way, either
> by keeping track if this is the first change to a bone in this frame and
> making it absolute and all subsequent ones relative or accumulating all
> changes into a temporary and then set it once all animations are applied.
The library also supports the blending of animations together like this for
skeleton blended geometries.
>
>
> The two tricky bit's left are the global frame handler which updates the
>> time and something that makes sure the skin+bone stuff is evaluated only
>> once a frame. For the frame handler I have to see if we can handle it
>> like the vrml loader which can be extended so it can live outside the
>> osg core (I don't want to have fileIO to dependent on a contrib lib)
>> or if we have to push this into the core.
>>
>
> agreed on the dependency. Why does the frame handler need to be extensible
> (perhaps it must be, I just don't understand the reason yet)? Grepping for
> framehandler only turned up the call from the CSMGLUTWindow to CSM::frame,
> which seems to only update time and trigger the SensorTask/TimeSensors.
> For time I think there needs to be a way that the user can supply it, in
> case there is other stuff in the application that has to run off the same
> clock (maybe that is already possible?).
> For example in a VRJuggler clustered app we'd like to feed time from a
> device into the animation since it is guaranteed to be in sync on all nodes.
>
> Short question, what is the grouping (for example AnimationTemplate)
>> for ?. Just to deal with a complex animation through one object ?
>>
>
> yes, primarily. Given that a human character model has 20-30 bones I
> consider it somewhat essential that I can start the "walk" animation
> with just one call. Animation (the playback object for an ATemplate) is
> also the level where the time scale, the playback mode (once, loop, swing)
> and direction (fwd, bwd) are set.
If there is interest, I would love to talk more about it. Because we are
excited about having this functionality in OpenSG 2, I would definitely be
willing to work on porting it.
Thanks,
David Kabala
>
>
> Cheers,
> Carsten
>
>
> PS: I've attached a tarball with the anim classes in case you want to look
> at it. Don't bother with compiling it though there is probably some other
> stuff missing.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users