Friday, October 17, 2008

Holy Cow! Papervision3D Materials Demo

Here is a little experiment with various Papervision3D and a static PointLight3D. Use the “shift” key to cycle through the various material skins.






I pulled the cow.dae model from a google search. I had to edit the dae a bit by stripping it of all the material, camera, and light references so that the file only defines the geometric mesh. This is so I can specify the camera and lighting in papervision and apply the materials dynamically through Actionscript. Also, for some reason I had problems swapping materials in the dae model using the Collada and DAE parser classes, as a result I had to convert it into a zip and then parse it using the KMZ parser.

The great thing about the KMZ parser is the ability to reference individual objects in the Collada (.dae). All Collada data is contained within the scene (registered as COLLADA_SCENE, not “scene”), I named the geometric mesh “Cow”. As a result, I was able to reference the cow mesh directly using my _cow DisplayObject3D variable and this simple line of code:
_cow = _KMZ.dae.getChildByName("COLLADA_Scene").getChildByName("Cow");

Then by referencing the material property of the _cow DisplayObect3D Flash can dynamically reskin the mesh with the material specified.


Download Source Code and Example

1 comment:

Pison Jaujip said...
This comment has been removed by the author.