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).