Papervision3D: Materials and Collada
Jan 19, 2009 Articles
Today I spent a little of my spare time playing with Papervision3D, in order to participate in a Papervision3D Competition. I quickly ran into a problem, to which I couldn’t find the solution the usual way (i.e. Google). However, I finally got it working, and I’m glad to write up my findings here for those of you who might face the same problem.
The Problem
The problem I faced was simple. I downloaded a few Collada files from Google 3D Warehouse, expecting it to work in my project out of the box. It did work, but it gave me a completely untextured model, like so.
After a little looking around, I spotted a post which suggested looking inside the DAE file, to check if its materials are pointing to the right locations!
The DAE File
I thought this might solve my problems, but unfortunately it was not the end of the story. When looking inside the file, I eventually came across these lines of markup.
While this gave me a little more insight, it did not help me much, since the Collada file did not come with any texture files at all. I did, however, spot an interesting attribute called “name”, which specifies the name of the material it is looking for.
The Actionscript
Back I went to my code, and had a look through the MaterialsList API. I decided to have a crack at the “addMaterials” method, which allowed me to specify a name for each material I add.
The Result
Lo and Behold! It worked! My Collada model was now “textured” with basic colours (though it isn’t too hard to make it use BitmapFileMaterial or even MovieMaterial).
The wonderful model shown here is the Spaceship/Fighter by SciFiDude.
Did this article help you? Be sure to post a comment below!
Tags: 3D, actionscript, Collada, ColorMaterial, DAE, Flash, Material, Models, Papervision3D, Texturing










June 25th, 2009 at 4:05 am
hey Daryl, thanks for the post it helped me a lot, well done for cracking it!
September 18th, 2009 at 2:23 am
Many thanks!!
October 9th, 2009 at 4:54 pm
thanks
January 22nd, 2010 at 3:47 am
Tkx m8, made my day:P