Microphone controlled animation in Papervision3D

This time I have something less mind-twisting then the bend modifier and all that math. The idea was to create an animation of leaves flying around, propelled by wind controlled with the microphone. This little experiment was also a good occasion to work with some new Papervision3D features.

Effects. The Papervision3D team decided to merge the Effects branch with Great White earlier this month. All the detailed information about that can be found on by Andy Zupko’s blog. There is a lot of cool stuff, so be sure to check it out. One of those is a new property of the DisplayObject3D called ‘useOwnContainer’. When set to true, all the classic bitmap effects can be applied directly to a mesh. In this case I used the BlurFilter, and the ColorMatrixFilter for the depth-of-field effect. The inspiration came from the really cool depth-of-field experiments by Mr.doob.

SimpleLevelOfDetail. With this one, the idea is that the further an object is from the camera, the less faces it has. That way we can get an important performance gain without sacrificing the quality too much. I tried to implement it, but I ran into some trouble. Later, after a brief discussion on the PV3D forum, Andy Zupko added the ‘SimpleLevelOfDetail’ class that implements this concept. I used it here. Thanks a lot, Andy!

Bend modifier. Finally, I use the Bend class to give the leaves a slightly more natural look.

Now, the fun part. The leaves react to the activity level of the microphone, so if you take yours and start to blow into it, they will take off and fly around. Be careful, if you blow too hard you will get a head rush! :)

If you do not have a microphone use your mouse wheel to create wind. Keep in mind however that it isn’t as much fun as with a mic. Also, on Windows, the microphone volume settings are really tricky and well hidden in multiple places, so if something is not working - double check those in the first place.

Last but not least, here’s the source code (updated Dec 17th 2008 to work with latest PV3D trunk).

32 Responses to “Microphone controlled animation in Papervision3D”

  1. imrahil Says:

    woho! sweet!

  2. felix Says:

    a good combination of techniques.really nice!

  3. Lee Felarca Says:

    Really, really nice. Thanks.

    Lee

  4. Andy Says:

    very cool use of the new stuff! very fun to play with and looks awesome!

  5. vitaLee Says:

    you made my day man.
    pretty cool !!!
    and thanks for the source - there are lots of things to learn from it.

  6. Juan Says:

    Great work man. It looks awsome and is very fun.

  7. barret Says:

    really great, awesome experience.
    May I add a little suggestion?
    Freeze the rotationY of the leaf as soon as it touches the ground; each leaf would stop rotating at a different time. Also, I would have the leaves closer to the screen (smallest Z) to rotate a bit faster than the ones away when the mic is blown. Great nevertheless!

  8. bartek drozdz Says:

    @barret I updated the demo in the direction you mention, and it looks better now. Thanks for the tips!

  9. Mr.doob Says:

    Nice effect! :D

  10. Animation Says:

    Hello!I got the most reliable knowledge about Animation is the process of linking a series of slightly different drawings especially, cartoons together to simulate movement.Thanks!

  11. Vincent Says:

    Hello,
    I’m in the as3 learning process and can’t seem to make it compile right, wether with flashdevelop or flash…i keep gettin Error #1007. Is it the embed of the external png? it seems the flex sdk allows things that flash don’t like… thanks for any help

  12. frank Says:

    wow, beautiful and inspiring

  13. stef Says:

    Very very nice. Bravo !

  14. Marcel Fahle Says:

    Bro’, you’re nuts! :)

  15. chris Says:

    You forgot to include mask.png?

  16. bartek drozdz Says:

    @chris Thanks for noticing that, I updated the ZIP file.

  17. julie Says:

    can i have fla file for this plz

  18. bartek drozdz Says:

    @julie unfortunately there is no FLA file for this project - it was done with FlashDevelop and compiled with a Flex compiler. I wrote a short note about this technique here: http://www.everydayflash.com/blog/index.php/2008/07/01/flash-on-free-software-flashdevelop-flex-sdk/

  19. PaperKing3D Open-Source Contest Results « Papervision3D Says:

    […] http://www.paperskate3d.com/ http://www.everydayflash.com/blog/index.php/2008/06/24/microphone-animation-papervision3d/ […]

  20. neil Says:

    Hi, I can’t find BasicView, how to find it. :)

  21. bartek drozdz Says:

    @neil If you do not have the BasicView class in your PV3D sources, that means you are probably using an old version of Papervision (1.5?). Get the newest 2.0 version here:

    http://papervision3d.googlecode.com/files/Papervision3D_2.0_beta_1_src.zip

  22. SimplicIT Says:

    Hi. I have compiled this in both FlashDevelop and the Flash IDE. I have correctly linked to all Classpaths too. I get no errors and a blank window. What am I missing?

  23. SimplicIT Says:

    Sorry, to add to my comment above:

    I do get the “Camera and Microphone Access” window. My output panel gives me:
    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at com.everydayflash.pv3d.leaf::LeafMaterialFactory()
    at com.everydayflash.pv3d.leaf::LeafDemo()

  24. bartek drozdz Says:

    @SimplicIT It won’t run correctly with Flash IDE due to the way I embed bitmaps - using [Embed]. Try to compile that with the Flex SDK compiler. Here’s a short note I wrote about how to start with:

    http://www.everydayflash.com/blog/index.php/2008/07/01/flash-on-free-software-flashdevelop-flex-sdk/

  25. PaperKing3D Source Code « Papervision3D - Developers Says:

    […] http://www.everydayflash.com/blog/index.php/2008/06/24/microphone-animation-papervision3d/ […]

  26. kevin Says:

    Hi,
    It’s awesome! Can you explain how to use it in flex 3 (IDE)?
    Thanks.

  27. RAGU Says:

    NOTHING IS HAPPENING WHEN I TRIED????

  28. Design Says:

    it is very lovely!!!

  29. SILENTYPER Says:

    Does anyone have all the classes you need for this compiled in one location that they can share… ie. the gskinner stuff, Tweener, ect…

  30. Jim_Nastiq Says:

    Hi,

    i’ve found all the class you need to compile but still have error before compilation…
    in DepthOfField, l.87 , new instance of ColorMatrix need an argument (array)
    and in Operator.as, l.22, new instance of DisplayObject3D require 2 arguments but there ’s more in the code…

  31. bartek drozdz Says:

    @SILENTYPER @Jim_Nastiq Things change very quickly in the open source world, and the code uses features that are no longer available.

    I’ve done a quick update of the sources: http://www.everydayflash.com/flash/pv3d/leaves/leaves-demo-2.zip

    This should work with latest pv3d version from SVN (as of Dec 18th 2008). As for the ColorMatrix class - I have included my old version in the sources now.

    Hope that helps!

  32. Jim_Nastiq Says:

    I’ve finally compile it and make it work ;-)

    great job, and thx for sources!

Leave a Reply