I have created a cube and applied materials and texture in blender (2.5). But when I import that model to Papervision 3d (2.1), I don't see anything - just a blank screen. On the other hand, if I use any other .dae model(for example, I am referring Papervision3D Essentials book, so I used those samples) then I can see the model. What's the problem? Why is the model that I exported from blender not working?
Here is my script:
package {
import flash.events.Event;
import org.papervision3d.events.FileLoadEvent;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.parsers.DAE;
import org.papervision3d.view.BasicView;
import org.papervision3d.objects.parsers.Collada;
public class modelTest extends BasicView
{
private var model:DisplayObject3D;
private var distance:Number = 1000;
private var speed:Number = 0.2;
private var rangeX:Number = 0.02;
private var rangeY:Number = 0.02;
private var rangeZ:Number = 0.05;
private var targetRotationX:Number = 0;
public function modelTest()
{
stage.frameRate = 40;
init();
startRendering();
}
private function init():void
{
model = new DAE();
DAE(model).load("assets/cube.dae");
scene.addChild(model);
viewport.interactive = true;
model.addEventListener(FileLoadEvent.LOAD_COMPLETE, modelLoaded);
}
private function modelLoaded(e:FileLoadEvent):void
{
trace("Used materials by this model: " + model.materials);
true).addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, click);
}
override protected function onRenderTick(e:Event=null):void
{
super.onRenderTick();
}
}
}
And this is the output:
INFO: Papervision3D 2.1 rev920 (August 11th, 2009)
INFO: Viewport autoScaleToStage : Papervision has changed the Stage scale mode.
INFO: DisplayObject3D: COLLADA_Scene
INFO: DisplayObject3D: Cube
INFO: DisplayObject3D: Lamp
INFO: DisplayObject3D: Camera
Used materials by this model: Material_001-material
Blender file : http://imageedit.netai.net/cube.blend
DAE file : http://imageedit.netai.net/cube.dae
PV3D hasn't been kept up-to-date, if you're looking to take advantage of Stage3D (Flash GPU acceleration for 3d scenes), you'll want to try Away3D or some of the other engines instead.
That being said, it's been a while since I've touched the PV3D stuff, but I remember I had to be very specific in how my Collada geometry was written - the parser in Papervision3D only reads a subset of the spec (if it tried to read the full spec, the parser would be enormous - part of why Away3d does not support it)
A search for "Collada blender export for Papervision" shows me some helpful posts on the web, eg:
http://osflash.org/pipermail/papervision3d_osflash.org/2007-February/001726.html
Tells us that your Collada export has to have triangles.
Or, you could dig into the Collada Parser and figure out what it's looking for - you'll see that the loader is only looking for triangles, and only in a specific spot in the XML.