Sunday, October 30, 2011

Collada DAE to Proscenium ActionScript Export Stage3D Flash11

        XML that X stating for exchange is well known format of exchanging files between different systems, programs and worlds. Thru Collada specification and its xml file format .dae  users could exchange 3D files created in diffrent 3D environments like Maya, 3D Max, Blender, Daz and so on... and this exchanging file format got supported in Procsenium as well.
 Having simple running animation of woman model having 51777 vertices in my DAZ exported .dae file, file reach 6.5MB (excluding all unnecessary and unsupported things like morphs) + 1.15MB jpg textures. By zipping DAE file I decrease it to 1.19MB (maybe some packing methods like built in Proscenium LZH would return even better results) but also increase the size of main.swf file, now containing the compression libraries and additional time to for unzipping. Also parsing of text file isn't avoided. All in all parsing of such big .dae (text files) takes a lot to time so I couldn't find logic in using DAE files by many developers in production phase. So lets underline again word EXCHANGE. By my opinion as clearly stated we should use .dae files for exchange and inside the Flash platform swf,swc as we would use .max files in 3DMAX or .obj files in WAVEFRONT...
      Being stubborn myself and want to prove the concept to other developers I built little AIR application that can preview .dae files and export then as .as .


  with options, texture files to be embed or loaded for external source. By using embed option (model+bones+animation+texture files) I succeed in getting export of 3.44MB swf size loading in less then 5s.
Exporter can create ActionScript files:

-Model.as that is planned for raw inclusion in your project.
-Model.as that is planned as external swf/swc and then loaded in main.swf. (6.5MB .dae was 4.5MB swf)
swf doesn't contain Proscenium.swc so duplication of  Proscenium.swc requred inclusion in main.swf  is avoided with bit loss of creation speed using getDefinitionByName function.
Model.as in both cases could have source for loading textures or to embed them

 There lot of space of improvements and upgrades like using ByteArrays or BinarySerialization to pack model data inside .as.
Next:
Option of generation of relative texture urls is in plan and prevention of duplication of embedlinks. (Currently manual fixed)
Reduce decimals like this 0.35814398527145386 to 6 digits think its enough?
 I wish to hear your toughs or at least support so I can provide more to the community and my 3 weeks day night effort isn't futile.
Someone said saying "Great model!". (I wonder if this is a showcase) :))))).

Source(+ air installation)
Test project file

7 comments:

  1. Sounds really cool. I've downloaded the source, but it would be easier if you could also post the .air file? Thanks for the good work ;)

    ReplyDelete
  2. hi , realy cool , i have a problem , how i can rotate the DAE file loaded in my air app , i want to roatate 360 deg. ?
    please email me at webersion@gmail.com

    tanx a lot

    ReplyDelete
  3. The trick is not to use DAE at all ;) Use 3DObject.appendRotation X,Y,Z

    ReplyDelete
  4. I'm using collada from 3dmax.
    Nothing happens after opening that file in air app.
    Looks like air can't import this particular file.
    I was trying to use example project but it throws Context3D create error.

    Additional question is: did you try just to embed *.dae xml and use loader to parse collada into 3d object? I'm trying to use "loadBytes" from ColladaLoader but have problems with "filename" argument.
    The idea to embed xml gave me some results with Away3d because flash naturally compress xml when doing swf's.

    regards
    Piotr

    ReplyDelete
  5. Contex3D error is probably cos you not using Flash 11 or above for export.
    Proscenium can't open all DAE files 100% as some sophisticated programs like 3dMax. (For example it doesn't support Morph Controllers...) So use only supported options. Problem as I said isn't just compression. You can zip xml. But parsing text or xml if you like.

    ReplyDelete
  6. Dear Winxalex. I came across your blog as a way to use Blender 3D with Sandy 3D. I am very confused as to how to do this as you did not really give steps as to how to do it. I wanted to know if it would be possible for you to list out the steps? It would be greatly appreciated.

    Dodzi

    ReplyDelete