Animating vertices in Papervision3D
Rotating cubes, planes and spheres in 3D is fun. However this time, I thought that I’d try something less basic when it comes to 3D animation. So here’s the idea: the Papervision3D universe is composed of triangles. Each object is a structure formed of one or more of them. The points where the triangles meet are called vertices (plural for vertex). A vertex, represented by the class Vertex3D, is basically a point in the 3D space with a ‘x’, ‘y’ and ‘z’ coordinates. The interesting part is that each of those vertices can be manipulated separately.
Click on the image above to view a demo. Once I grasped the basic idea that vertices can be manipulated, such effect was pretty simple to acheive. First I create a plane, I add a bitmap texture, and then I access the vertices of the plane one by one and manipulate their ‘z’ property.
For the animation I create a small bitmapData object and apply the perlinNoise on it at each frame with different settings to create this illusion of wavy movement. Then I translate the color value of each pixel to the ‘z’ property of each vertex in the 3D plane. Later I multiply this value by stage.mouseX, so the effect will vary in intensity depending on the mouse position… And voilà! I have a waving flag, a small piece of a stormy sea, a rodeo-style magic carpet or whatever.
Move your mouse cursor around from the right to the left side of the screen. Click anywhere to switch between a bitmap texture and a wireframe texture. In the wireframe mode the movement of the vertices is much easier to spot and understand.
BTW. I created a project on Google Code because I needed an SVN account for personal use, but I discovered that the code browser is also pretty cool for sharing stuff and it even formats AS3 in a nice way! So, if you are interested in the source for this example, it is here.

May 6th, 2008 at 12:30 pm
[…] The interesting part is that each of those vertices can be manipulated separately.” View the demo and download source file […]
May 6th, 2008 at 6:57 pm
Very cool! I just happened across your site. This animation is very nice. It looks so fluid and beautiful. Now I’m going to have to see what else you got here…
May 8th, 2008 at 7:40 pm
Hi Bartek,
I can not thank you enough for putting this up. I was able to create a 3D plotter using this code. The address is below
http://nkuflc.org/sincplot/
I acknowledged your work at the bottom of the project and linked back to this site. When I get it up on Youtube and Google Code I will put the link here.
Thank you so so much for your incredible work on this!!!
May 9th, 2008 at 9:42 am
@Dan. Thanks. The blog is pretty new so you won’t find much now, but I will try to post new stuff on a more-or-less-regular basis.
@Mike. I am glad that my code was helpful to you, and thanks for the acknowledgement. I release all my sources under the MIT license, so you are free to use it anyway you want (just so you know…)
May 9th, 2008 at 12:02 pm
Thanks so much!
My Google Code is at
http://code.google.com/p/flex3cookbook1/downloads/list
and the YouTube videos are at
3D Plotter in Papervison3D and Flex 3 (1 of 2)
http://www.youtube.com/watch?v=YlFLT9YA444
3D Plotter in Papervison3D and Flex 3 (2 of 2)
http://www.youtube.com/watch?v=TvpIFLLLKp8
Another application of this is to use it as a terrain builder for games.
Once again, thanks so much - I didn’t have a clue on how to do this
until your video.
Best Regards,
Mike Lively