From Blender to Papervision3D

Here is a simple wheel I created using Blender. The wheel is exported from Blender as as COLLADA object (*.dae file).

Use Cursor Keys to rotate the model, and Space to roll.

Along my way of creating this stunning artwork :) I came on to some difficulties with Blender and the Collada plugin. Such problems are always frustrating, so here are some notes that may help:

  1. Do not install the latest Blender release (2.45 at the time I write this). Use 2.43 instead, as the Collada 1.4.1 script is not working properly in the newest one.
  2. You need also to install the Python programming language because the Collada script needs some libraries that are not part of the Blender distribution. You need to set some environment variables in order make it work, but the Blender documentation mentions only one, PYTHON, which does not seem enough. After some research I found out that you need tow of them:

    PYTHON=[path to python.exe in the python instaloation folder]
    PYTHONPATH=[path to python instalation folder and some other folders]

    On my computer it looks like this:

    PYTHON=”C:\Program Files\Python\python.exe”

    PYTHONPATH=C:\Program Files\Python;C:\Program Files\Python\DLLS;C:\Program Files\Python\LIB;C:\Program Files\Python\LIB\LIB-TK

  3. If you do not know anything about Blender (like me) check out this tutorial. I helped me alot.

UPDATE May 17th 2008. Source code. I decided to publish the source for this example. Grab it here.

8 Responses to “From Blender to Papervision3D”

  1. Karl Says:

    That’s great - I’ve just managed to load up my first dae from Blender into papervision, but I can’t work out how to access the object for position, rotation etc…

    Here’s my .as file -

    package {

    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.events.Event;

    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.Collada;
    import org.papervision3d.scenes.MovieScene3D;

    public class collCube extends Sprite
    {

    public var scene:MovieScene3D;
    public var camera:Camera3D;
    public var dae:Collada;
    public var myobject:DisplayObject3D;

    public function collCube() {
    init();
    }

    private function init() {
    //basic scene stuff
    var container:Sprite = new Sprite();
    container.x = 200;
    container.y = 200;
    addChild( container );

    scene = new MovieScene3D(container);

    camera = new Camera3D();
    camera.z = -500;
    camera.zoom = 5;

    var dae = new Collada(”cube.dae”);
    var myobject = new DisplayObject3D();

    myobject.addChild(dae);
    scene.addChild(myobject);

    stage.addEventListener(Event.ENTER_FRAME, runtime);

    }

    private function runtime(e:Event):void {
    //WHAT CODE DO I USE HERE?
    //dae.Cube.rotationX += 5;
    scene.renderCamera(camera);

    }
    }
    }

    Would love it if you could help me out - or even better - post the code from your example.

    Cheers

    Karl

  2. bartek drozdz Says:

    In my code it goes something like this:

    cola = new Collada(”model.dae”);
    colaHolder = new DisplayObject3D();
    colaHolder.addChild(cola);
    scene.addChild(colaHolder);

    and then I modify the colaHolder properties such as rotation, postion etc… Anyway, I updated the post with the source files (see above), so grab them and check them out!

  3. Karl Says:

    Thanks Bartek, that’s a great help! I’d managed to do it using the PV3D components, but this way seems to have more flexibility - eg for combining collada objects and PV primitives. Have you had any success exporting meshes with armature animations as colladas from Blender? Can’t get those to work either…
    Can’t wait for Blender 2.46 by the way.

    Cheers

    Karl
    http://www.twodotsinacircle.com
    check it out

  4. ¿Cómo pasar un modelo 3D a Flash? - Pasando archivos de blender a PaperVision3D « Shift F12 Says:

    […] Este tutorial nos explica ¿cómo pasar un modelo de Blender*? a una aplicación de PaperVision3D. :-) […]

  5. vitaLee Says:

    hi Bartek.
    where are suppose to set these python paths you were talking about?

  6. bartek drozdz Says:

    @vitaLee These are the windows system environment variables.

    On an XP machine you set them by right-clikcking the ‘My Computer’ icon, choosing the ‘Advanced’ tab and then ‘Environment variables’ at the bottom.

    You will see 2 panels, one for user variables on the top, other for system variables on the bottom. I added the Python related variables to the system ones so that they are available for every user.

  7. MikeTheVike Says:

    Have you tried using the newest version of Blender? I think they might have fixed it. I successfully exported a dae file and loaded it into Papervision.

  8. bartek drozdz Says:

    @MikeTheVike No, I haven’t. But I intend to go back to the Blender/PV3D topic later this month, so I will check that and maybe update this post. Thanks!

Leave a Reply