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:
- 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.
- 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
- 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.
May 17th, 2008 at 5:25 pm
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
May 17th, 2008 at 9:51 pm
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!
May 18th, 2008 at 11:11 am
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
May 28th, 2008 at 10:33 pm
[…] Este tutorial nos explica ¿cómo pasar un modelo de Blender*? a una aplicación de PaperVision3D. :-) […]
July 5th, 2008 at 12:29 pm
hi Bartek.
where are suppose to set these python paths you were talking about?
July 6th, 2008 at 11:18 am
@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.
July 31st, 2008 at 10:57 pm
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.
August 5th, 2008 at 9:42 am
@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!