Molehill (away3d broomstick) 3D model viewer

April 1st, 2011
by admin

I’ve recently converted my old model viewer to away3D (it was using papervision3D).
molehill model viewer
This is the version which automatically loads well-known papervision3d x-wing model:
molehill papervision3D X-Wing
This is the version automatically loads a face generated with 3Doodler ( :P ), looks nice with subsurface scatterin 3Doodler face
(if you don’t see anything, you probably should have installed Flash Player version 11+)

ModelViewer supports OBJ, 3DS, Collada, MD5, MD2, blah blah blah…
Since Away3D Broomstick is in alpha stage, my viewer is alpha too. It supports Collada objects (DAE and ZIP files) because I had to write DisplayObject3D – to – ObjectContainer3D converter: “PaperAway


var mesh:Mesh = PaperAway.fromDo3D( displayObject3D );

That’s all :P Well, there are some additional options, but I won’t describe them here, read the code yourself…

Some strange things I’ve noticed in molehill’s/away3d’s coordinate system – uv coords are assigned to vertex indices, not face indices. This forces you to do either of two things:
– make too many vertices, one vertex per face vertex
– check for vertex UV coords and create new vertex only if the uv coord of given vertex is unique. This is confusing explanation, you can check it in the source code for , starting from line 242.
Class PaperAway is not fully featured, it does not create materials according to Papervision3D’s shadedMaterials. Also it does not transfer interactive events of displayObject3D.

These are the issues with Away3D which I’ve spotted so far (some descriptions are very sketchy, sorry):
-material.dispose() generates null exceptions
-model.clone is erroneous because SubMesh system is not fully implemented
-model.dispose() is kinda erroneous too
-submeshes materials does not resemble corresponding scenegraph meshes materials.
-parser of OBJ files – OBJParser – falls into infinite loop when supplied OBJ file has materials defined, by the material file does not exist. In errorMtl() function writing after the trace command “_mtlLib = false” solves the issue.
-there are some problems with updating textures. You can see them by clicking on wireframe and then on “normal” – texture’s not getting updated.

Tags: , , , ,
Posted in flash experiments | Comments (6)

6 Responses to “Molehill (away3d broomstick) 3D model viewer”

  1. Mark Says:

    Nice, I’m looking to migrate from papervision across to either Away3D or Alternativa3D, and one of the things I was working on was a collada viewer, which I got stuck on trying to combine the uvmap and shaders, so I though rather than bang my head against a rock trying to figure it out in papervision I might as well focus my efforts on getting it working using the gpu..

    Any chance of source code?

  2. admin Says:

    Gave the source for “”, the model viewer does not contain any sophisticated code ; p just loading the model using Papervision/Away3d importers and showing them on the screen

  3. Mark Says:

    Okay, I’ll have a little look, thanks!

  4. Matt Przybylski Says:

    Hey (sorry, couldnt find your name anywhere on the site),
    I’m trying to use Broomstick currently as well and ran into two of the same issues.

    1) I can’t clone a Mesh, seems only cloning primitives works right now
    2) Cloned meshes don’t have interactive events (I wrote my own clone method which failed miserably so this could be part of the problem with this)

    Have you come up with a solution yet for cloning a Mesh (or even an ObjectContainer3D)?

    Also, good to see other Polish flash devs. I’m obviously Polish as well as you can probably tell by my last name :) Dzienkuje za twoja prace na tym blogu (my spelling is terrible).

  5. admin Says:

    After 3 months, but I’m answering u : )
    2) Interactive evts were pretty experimental in Away3D, didn’t test them cause I feared of running into infinite problems loop ; )
    1) As far as I remember, cloning was broken in Away3D (don’t know how it is now), you must iterate every child and clone it, then gather children into an array and update the submeshes array. Iterating over children goes like this:

    public static function iterateMesh( mesh:ObjectContainer3D , func:Function ):void{
    var child:ObjectContainer3D;
    var i:int;
    var stack:Vector. = new Vector.();
    stack.push( mesh );
    while( stack.length ){
    mesh = stack.shift();
    if( mesh is Mesh ) func( mesh );
    for( i = 0; i < mesh.numChildren; i++ ){ stack.push( mesh.getChildAt( i ) ); } } } I do something simmiliar in, I go through Papervision's object scenegraph, gather children and then put them into new Away3D mesh. Then I fill the submeshes array with gathered children.

  6. Unani Says:


Leave a Reply