3DS Parser Added To Papervision From Away3D

Good news, I meant to post this a few days ago last weekend Tim Knip added 3DS parsing support to Papervision3D. Here is the thread with the quick howto.

Thread in nabble

Added a simple 3DS parser to the Great White trunk.
=> org.papervision3d.objects

.parsers.Max3DS

…USAGE:


// where to find textures
var textureDir:String = "./images/";  // use a trailing slash!

// optional materialsList
var materials:MaterialsList = new MaterialsList();

// the 3DS file
var fileName:String = "[path-to-3ds-file]";

// load it!
_3ds.load(fileName, materials, textureDir);

// add to scene
scene.addChild(_3ds);

Also, one other golden nugget is Den Ivanov’s newest demo with Papervision portals! This is a very smooth demo, be sure to enter into the portals to see the seasons change.

Also here is a  non papervision 3ds parser.

Advertisements

17 Responses to “3DS Parser Added To Papervision From Away3D”

  1. Mr.doob Says:

    This is good because 3DS is one of the tiniest formats available. I did some tests and I think it was even smaller than .dae zipped.

  2. drawk Says:

    Yeh dae/collada is awesome but it is xml based == bloat. Makes it a good transport format but runtime format has lots of overhead. At some point making models directly to swf or in multiple formats easily will be needed for flash 3d. 3ds is good because there are lots and lots of 3ds out there as you know and it is crunched down. Still the parsing time for dae, 3ds, md2 etc could use a caching layer there to swf on the fly so loading and memory could be lower maybe. Hrm parsing time, sound like a good little study.

  3. Junio Vitorino Says:

    With this isn’t necessary export to collada format?

  4. Bart Claessens Says:

    Hi, thanks for the parser but I don’t get it to work yet.
    I made a simple box in Cinema4D and exported it to .3DS, no textures attached.

    When I use your code in combination with the basic code to set up a papervision3D scene: http://www.insideria.com/2008/02/papervision3d-part-1-foundatio.html

    I get the following error at:
    _3ds.load(fileName, materials, textureDir);

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at be.billy.site.controller::MainController/initPapervision3D()
    at be.billy.site.controller::MainController()

    Why is it that the texture map has a default value of ./images/ in the method .load?

    Can’t I load shapes without textures?

    Thanks in advance
    Bart

  5. drawk Says:

    Hey Bart,

    Do you have the latest and greatest from the PV3d SVN? I will try to post some tutorials on 3d formats for flash in the coming weeks. I think this is one of the stickiest hurdles when using 3d in flash.

  6. c0nk3r Says:

    hi drawk … thanks for parser .. but my model is only viewed in
    wireframe because it has no texture. how i can add a shader/color/bitmap (what ever) on it ?

  7. DoomGoober Says:

    Yeah, the 3DS loader is choking on my textures too so everything is rendering in wire frame. I debugged the code and it isn’t even finding the MAT_TEXMAP chunks, so my guess is that the file read position is getting messed up before then.

  8. Tyler Egeto Says:

    Hey guys, this is great news, were are working on something in the office and we’re working with .dae format, this really is nice! Love the file size difference. We were getting the wire frames too, however after I set the path in Papervision rather than relying on the parser to find it, it all worked great!

  9. DoomGoober Says:

    Tyler — Can you please explain what you mean when you say you set the path in Papervision? Are you saying you hardcoded the textures into the MaterialList?

  10. DoomGoober Says:

    I tracked down the bug in Max3DS.as that is causing the textures to parse incorrectly. The fix is simple:
    In the file Max3DS.as in the function parseMaterial() remove all instances of the following two lines of code:
    p = _data.position;
    _data.position = p;
    These lines are moving the pointer in the data stream which is making the chunks read incorrectly.

  11. Yakazoo Says:

    Hey guys,
    I have some problems here.

    I am not able to load my 3ds file and dont know why.
    I commented out euch line wiht p = _date.position
    and _data.position = p + colorChunk.length from the MAX3DS.as file
    And i am always getting this Error
    TypeError: Error #1009: Cannot access a property or method of a null object reference.

    I just want to load the object without any textures. What to do?
    THXs

  12. George Profenza Says:

    I had a look at MAX3DS.as and it fetches the vertices, faces, etc. and draw them in a single DisplayObject3D. That means there is not way to fetch nested objects, right ? At the moment I’m thinking I should export a 3d object intro several 3ds files and regroup them once their 3ds’ are parsed. Is there a better way of accessing child elements using the 3ds format ?

  13. cyberprodigy Says:

    Bart. if you get error message

    TypeError: Error #1009: Cannot access a property or method of a null object reference.

    then probably you have forgot to convert exported object from 3Dmax in Mesh. To convert object to mesh right click on object, and choose “Convert to -> Convert to editable mesh”

    Hope this helps

  14. PlaneSailing Says:

    Similar to C0nk3r – I loaded in my 3DS model ok but got a multicoloured wireframe with no Max material colours, what’s the best way to add colours in Papervision without using textures?

  15. artur Says:

    I’m loading a 3ds in the correct way, it has not texture embedded, I wanna assign it via Actionscript, I mean I have a basic texture in the flash Library and I use it like BitmapAssetMaterial, I added to materialist object, but I still see the model in wireframes, someone can help me or tell me how add texture to a 3ds via papervision?

  16. tamarinda Says:

    Hi Artur,

    I had the same problem, I solved it printing the name of the materials of the objects in the Max3DS object.
    //
    In class Max3DS (line aprox 122):
    var mat:MaterialData = meshData.materials[i];
    var material:MaterialObject3D = this.materials.getMaterialByName(mat.name) || MaterialObject3D.DEFAULT;
    trace(mat.name);
    //

    so you know each name of the materials given in MAX3DS, each material in the material list should have the corresponding name shown at the output.

    I hope that helps!

    ·:· ·:·;
    tamarinda


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: