Papervision3D 2.1 – alpha

Just committed rev. 911 to the Papervision3D SVN trunk. Rev. 911 and upwards will become Papervision3D 2.1 because the changes made are quite big.
Major changes where made to the DAE, MD2 and animation classes.

NOTE:
This revision is considerably different then previous revisions. Use with care!
At this point its not advised to use rev. 911 for production.

This revision fixes several issues regarding the DAE class:

  1. vertex-animation
  2. nested animations
  3. Cinema4D support
  4. morph-weight animation
  5. splines
  6. cloning
  7. play(), play(“clipName”), stop(), pause(), resume()
  8. more…

The whole org.papervision3d.core.animation.* package has been revamped completely to allow for the changes in the DAE class.

DAE Example:

var autoPlay : Boolean = false; // don't play animations automatically
 
var dae : DAE = new DAE( autoPlay, "myCollada" );
 
dae.addEventListener(FileLoadEvent.LOAD_COMPLETE, onDaeComplete);
dae.addEventListener(FileLoadEvent.LOAD_PROGRESS, onDaeLoadProgress);
 
// optionally pass materials to DAE
// NOTE: here's a change with previous revs :
// 1. lookup the <material> elements in the COLLADA file (inside <library_materials>).
// 2. write down / remember the @id attribute of the <material> element.
// 3. materials.addMaterial( myMaterial, materialElementID ).
// ==> this will probably change in future revs
var materials : MaterialsList = new MaterialsList();
 
// If textures fail to load optionally add some search-paths 
// (relative to the swf):
dae.addFileSearchPath( "images" );
dae.addFileSearchPath( "textures" );
 
// set to true if you get a script-timeout error
var asyncParsing : Boolean = false;
 
// load it!
dae.load( "/path/to/dae", materials, asyncParsing );
 
/**
 * The DAE has loaded completely
 */
private function onDaeComplete(event : FileLoadEvent) : void
{
     var dae : DAE = event.target as DAE;
 
     // add to scene
     scene.addChild( dae );
 
     // start playing animation (if any available)
     // other animation controls include :
     // 1. play( "clipName ")
     // 2. stop()
     // 3. pause()
     // 4. resume()
     // 5. playing (getter: bool indicating if playing)
     dae.play();
 
     // lets create a clone
     // NOTE: DAE#clone() is somewhat bugged still, 
     // but seems to work in most cases
     var clone : DAE = dae.clone() as DAE;
 
     // add clone to scene
     scene.addChild( clone );
 
     // move it a bit
     clone.x = 200;
}
 
private function onDaeLoadProgress(event : FileLoadEvent) : void
{
 
}

MD2 Example:

var md2 : MD2 = new MD2();
 
var material : MaterialObject3D = new WireframeMaterial();
 
md2.addEventListener(FileLoadEvent.LOAD_COMPLETE, onMD2Complete);
 
md2.load("/path/to/md2", material);
 
scene.addChild(md2);
 
private function onMD2Complete(event : FileLoadEvent) : void
{
       var md2 : MD2 = event.target as MD2;
 
       md2.play();
       // or play some clip :
       // md2.play( "run" )
}

Animation:

Click the image below to show an example of the new animation controls.
Animation Test
Download the source of this example here.

The DAE and MD2 class implement IAnimatable, IAnimationProvider and IControllerProvider, which can be found in the org.papervision3d.core.animation.* package.

As so much has changed I’m sure some bugs are introduced. Please let me know!

PS: I’ll be on vacation until june 8th, so its unlikely I’ll be able to fix any bugs before that time.
PS2: Many people have helped by submitting code-snips, reporting bugs etc. I’ll credit you all when I’m back :-)

48 Responses to “Papervision3D 2.1 – alpha”

  1. xleon Says:

    Great job Tim. I think many people has been waiting for this.
    I think is great the way you handle materials, and the dae.addFileSearchPath(“”) method.

    Thanks!

  2. Michel Says:

    Wow thanks,

    Did a quick test with a quake 2 md2 can be viewed here: http://www.michelvandersteege.nl/test/walking/

    Works really good and simple!

  3. Ringo Says:

    Awesome Tim, have a nice vacation.

  4. Seeker Says:

    Thanks Tim. Works awesome. Working on hit detection, if anyone has any hints :)

  5. 布里斯班 Says:

    This is so cool!
    Great work.

  6. Takeshi Says:

    I want a DAE animation sample like “AnimationTest.as”.

    Whatever I tried, a DAE file couldn’t start the animation with Papervisio3D 2.1…

    Papervision3D 2.0 can animate a DAE file.

  7. Tim Says:

    Hi Takeshi,

    Quite possible there’s some bugs introduced with 2.1.

    Now on vacation until June 8th. Happy to help when I’m back.
    Until then: try to experiment bit.

    Use dae.animation.play() etc.
    Quite sure animation should work with 2.1 too

  8. Takeshi Says:

    Thanks Tim.

    Flash CS4 for Windows Vista was OK.

    Flash CS3 for Windows Vista was NG.

    (Papervision3D 2.1 DAE animation)

  9. Miguel Kennedy Says:

    Hi Tim…

    Thanks for the hard work implementing these much needed features in PV3D… It made the engine much stronger ;)

    Are you planning on implementing interpolation between transitions (clips)? Much like the Away3D engine does.

    Please check this for more info http://www.closier.nl/blog/?p=83

    I think that with this feature (interpolation) and the ones you committed to rev 911 PV3D would be the perfect choice for character animation and control.

    Let us know if you’re thinking about implementing this in the near future and get some rest while on vacation. It’s well deserved.

    Miguel Kennedy

  10. twodots Says:

    Hi Tim

    I’m trying to use the updated class to import bone-keyed animations from Blender 2.48 but despite everywhichway tweaking cannot get the dae object to display, let alone animate. I think it may be something to do with the materials – I have put the material id in the relevant place and I get a ‘coercion of type string’ error.

    I have prviously used the Collada class to import objects with no keyed animation and a uv tex but am keen to do what you have demo’d with the skeleton model.

    Do you know of a way to export a bone-keyed animated .dae type from Blender 2.40 into as3/pv3d (I’m at revis 915) and control it as your DAE class implies I should be able to?

    Many thanks,

    Karl

  11. twodots Says:

    sorry -meant Blender 2.48
    K

  12. Tim Says:

    Hi Miguel,

    These transitions seem quite easy to implement.
    I’ll look into it asap.

    Tim

  13. Miguel Kennedy Says:

    Hi Tim,

    That’s awesome news!!! You made my day, really!

    Thank you so much for looking into it and for your commitment to the community.

    You just got yourself a new fan :)

    Miguel Kennedy

  14. Tim Says:

    Karl,
    Beleive dae export from Blender is not very stable (invalid dae). Especially when it comes to bones / animation.
    It could help if you send me the collada file or the .blend.

  15. twodots Says:

    That’s what I’m thinking too – I’m going to try Cast3d, they have a patch to clean the blender dae. If that doesn’t work, I’ll send the docs. Thanks again. I’ll let you know what happens. K

  16. matthieu Says:

    Hello, i was stucked with C4D DAE export file for quite a long time.
    I was about to cancel my project.
    Do you have any details about the addons in C4D DAE features please ?

    Thank you !

  17. Tim Says:

    Well, DAE now follows the COLLADA spec better. Hence COLLADA exports from C4D should now work. Did not test extensively, so best is to simply try the updated DAE class.

  18. Kaleb242 Says:

    Thanks for developing these additional features for dae animation, Tim… I too would really appeciate a way to interpolate a smooth blend between various clips.

    And if there was a way to specify a duration in seconds for this interpolation between clips, it would give the animator a method to store a library of short clips as “poses” in the dae, and allow to tween between those clip positions. This would help keep the dae file size small, and the range of animation possibilities much higher.

    Right now I’m working with a 25 second DAE animation of a 3K humanoid model, which needs to sync with a vocal track. The DAE export from Maya is 5 MB with 30 fps animation, and 2 MB at 15 fps.

    The problem is that pv3d can’t seem to synchronize with the audio at 15 fps, even if the Flash document properties are set to 15 fps, the DAE animation still seems to play twice as fast as the audio.

    I think the ability to dynamically specify a frameRate for the dae animation, maybe even at runtime, would be very very helpful.

    And for long clips, the ability to play DAE frames backwards and/or forwards with a specified duration by frame number would be very helpful, especially if this could be controlled using a Tween class such as TweenMax or Tweener.

    :)

  19. Zao Says:

    How can I export Md2?

  20. eren Says:

    Hi Tim,

    First let me thank you for the updates, I’m inspired to do so much now that I can import animations. I have a problem though.. i dont understand how clips work and how to define them.. do i label them in 3d software before exp into dae or is it just measured somehow based on keyframe count.. thanx for your time

    -eren

  21. Javad Says:

    Hi Tim,

    I have an application created with pv3d 2.0 that uses an animated collada file.

    Whereas before I was able to do this:

    channels = dae.getAnimationChannels();

    and then this to get to the required frame:

    if(channels)
    {
    for each(var channel:AbstractChannel3D in channels)
    {
    channel.updateToFrame(currentFrame);
    }
    }

    it seems that we no longer have that option available.

    Do you have any advice as to how we should migrate legacy apps that have been created this way to use clips?

  22. Tim Says:

    Hi Javad,

    You now need to do something like:

    var channels : Array = dae.animation.channels;

    if(channels)
    {
    for each(var channel:Channel3D in channels)
    {
    channel.update( timeInSeconds );
    }
    }

    Note that animation is now time-based instead of frame-based.
    You might need to update your apps accordingly.

    Check out org.papervision3d.core.controller.AnimationController and the
    org.papervision3d.core.animation.* package.

  23. Javad Says:

    Hi Tim,

    Great – using that approach I found that all I needed to do is to divide the frame number that I was using previously by the frame rate of the 3D model.

    Given a framerate of 30 for the model if i want to go to frame 6 then my timeInSeconds becomes 6/30.

    Overall performance is a lot better too.

    Thanks a lot

    Javad

  24. Marcos Zanona Says:

    Hi Tim, I notice that there were some changes regarding DAE Files with ShadedMaterials within the late revisions of Papervision 2.1
    For example:

    map.load(‘_assets/dae/map.dae’,new MaterialsList({all:new GouraudMaterial(light)}));
    map.addEventListener(FileLoadEvent.LOAD_COMPLETE,function(event:FileLoadEvent):void
    {
    scene.addChild(mapa);
    });

    This works perfect till rev 910 for me… but from 911 I just get Wireframe Material as result. Could you tell me what changed regarding this kind of situation?
    Thanks in advance

  25. Tim Says:

    Hi Marcos,

    My bad… will fix in the near future.

    new MaterialsList( {all:….} ); doesn’t work with current revision.

    You now need to lookup the elements in the COLLADA file and use their @id attribute (or, if not working the @name attribute).
    Then use the thus found material-names as follows:

    var materials:MaterialsList = new MaterialsList();
    materials.addMaterial( myMaterial, myFoundName01 );
    materials.addMaterial( myMaterial, myFoundName02 );
    etc.

  26. Augmented Reality Talking Head Demo 2 « The Talking Head Blog Says:

    [...] information about PV3D 2.1 can be found in the blog posting by Tim Knip here http://techblog.floorplanner.com/2009/05/26/papervision3d-21-alpha/ Possibly related posts: (automatically generated)Augmented reality shooter shows the future of [...]

  27. Francisco Says:

    Hi,

    this example doesn’t seem to build with PV cs4, wich i think is the lastest release. Do you have some tip to fix this problem??

    therem isn’t md2.animation and AnimationController doesn’t exist.

    Thanks for any help.

  28. Tim Says:

    Hi Francisco,

    Looks like you’re compiling with an old revision of PV3D.

    You need to checkout the latest code from SVN trunk : http://code.google.com/p/papervision3d/source/checkout

    Then point CS4’s classpath to the checked out source.

  29. Vaasu Says:

    Hi Michel,
    Your walking Demo is cool.
    Can i have the source code ……
    Thanks

  30. cero Says:

    I managed to control my animation with stop () and play (), I also like to do it through play (md2.animation.clipNames [currentClip]) but do not quite understand the concept of “Clip” in a 3D animation. My question is:
    How to mount a 3D animation “Clip” from Blender or is everything in Papervision3D?

  31. Nandi Says:

    Hi Tim,

    I’m using your example and mostly works fine, except that I couldn’t stop the animation after it’s played 1 time (I don’t want it keep looping). Thanks for any suggestion or help.

    Rgds,

  32. cero Says:

    Hola para todos
    Michel, observé tú trabajo y me gustó mucho:
    ¿Ahora quiero saber cómo le creas los Clips a la animación?

  33. Olive Says:

    Hello there,

    Great ressource, thx very much ! I do have a bit of a trouble thought. My texture won’t import correctly with the md2 file and it won’t import at all with the dae.

    Evrything else is working. I’m using the qtip pro exporter for 3ds max 2010. Maybe i’m not doing it wright. Do you have any ideas ?

    Thx so much.

  34. Roberto Says:

    Hi Tim,
    Nice stuff there.
    I’ve done a lil’ example of an animated CUBE but it seems that teh animation doesn’t work properly.
    I’ve done it in C4D R11 with just an scale on X,Y,Z axis, exported as COLLADA, imported as DAE on my papervision file,but I only get the X (or Z) axis animated.
    Have u (or somebody else) runned into the same problem?

    Thanks

  35. doo Says:

    Hi Tim.
    I have found in testing md2 a problem ,in the clip replay will “jump frame”.
    like this
    md2.play(“run”);
    Observe the animation, you will find this skipping problem(In your md2 example there is also the question)

  36. Michael Says:

    i’m new to AS3 and papervision. I’ve been trying to use “_currentTime” in abstractChannel3D.as. i finally realized i was not loading “CS4″ pv3d (can i do this using CS3 without error?) i’m trying to get the current time from an animated .DAE, but i’m getting the following error at runtime: error DAE.as line 87 IAnimatable not found etc…

    have you heard of this problem? i’ve wasted so much time on this any direction you can give me would be most helpful.

    thanks for all this work; it’s truly awesome!

    mm

  37. Michael Says:

    actually the two errors are:
    DAE.as at line 87
    1045: Interface IAnimationProvider was not found.

  38. Tim Says:

    Hi Michael,
    Think CS3 may still ref some old (pre-2.1) classes.
    Please try “delete ASO files” in CS3 menu.
    Anyways: for sure looks like your mixing 2 different revisions of PV3D

  39. Michael Says:

    yes, i think you are right. there seems to be some PV3D base classes in my FLAR that the piece is referencing. when i remove them and try to load the CS4 PV3D flash throws many errors. i’ve run out of

    i have most my project done, just need a few things to wrap it up. is there any one out there interested in helping me finish? here is the current state of things:

    1. print marker: http://www.theredbuzz.com/arTest/Data/visionLogo.pdf
    2.) go to: http://www.theredbuzz.com/arTest/
    3.) wait for the message at the bottom to say “model loaded”.
    4.) press “add video” on the bottom left menu
    5.) allow webcam access
    6.) hold marker in front of web cam

    play with the buttons on the left to scrub various parts of model animation. these will be triggered by user marker movements etc…

    thanks.

    mm

  40. DAEクラス - digital-note7s jimdo page! Says:

    [...] http://techblog.floorplanner.com/2009/05/26/papervision3d-21-alpha/ [...]

  41. DAEクラスの情報 - Digital-note:Papervision3D Says:

    [...] http://techblog.floorplanner.com/2009/05/26/papervision3d-21-alpha/ [...]

  42. Jesse Says:

    I’m having issues with my textures in papervision3d. Can you or someone you know help. Everything is working just the textures sometimes freak out. I’m exporting DAE from 3ds Max and loading externally into Papervision. the sample dae I have works fine. email me at jesse (dot) newsome (at) gmail

    I can even paypal a few bucks for some help. I have my animations done I think i’m exporting them wrong or did them wrong from what i’m reading.

  43. Tim Says:

    The DAE class sometimes has problems choosing the the correct UV “set” (there can be multiple UV sets in a COLLADA file). So if your textures look “weird” you can choose a specific UV set by using DAE#forceCoordSet = mySet. This will force the DAE to pick UV-set “mySet”. Where “mySet” is an integer in range [0 .. numSets].

  44. Trent Sterling Says:

    Were transitions/interpolation ever added? I would really like to see this, as my character has many animations, but many of them don’t really ‘blend’. I’m using r932.

  45. spivvi Says:

    Great work!

    Just a little hint for all guys they try to get their armature animations – from Blender models – work:
    Don’t make your armature parent of your object. Use a armature modifier instead and assign your armature as a modifier of your object.
    Don’t use the modified translator.py from cast3d website. It won’t work for this dae-parser.

    DAE-export settings:
    * only export selection
    * disable physics
    * use relative paths
    * use UV-Image Mats

    works for me :-)

  46. spivvi Says:

    addition:
    But if you want to use the cast3d animation framework and convert your dae to x3c you have to use the translator.py.fix.
    :-)

  47. Rohan Rehman Says:

    Tim I’ve been trying you’re added animation controls which work great.. and saves us from manually alot of manual tweening.

    But I’ve tried testing the morph animations and I am getting no animation displayed.
    This is creating “Shape Keys” animation in Blender and exporting our DAE file.
    There are no issues when trying to play a LocRot animation.

    Exactly what type of morph animations does the DAE class handle when using Blender?

    Thanks Tim.

  48. Tim Knip Says:

    Hi Rohan,

    I’m not sure Blender exports “shape keys” to Collada.
    If it does, I’m pretty sure the DAE class *can’t* handle it alas.

    Best is to mail me (tim at floorplanner dot com) the blend file and / or collada so I can take a look.

    Tim

Leave a Reply