How do I use an .awd file exported as a AWD2 from Prefab

Software: Away3D 4.x

DorkBot, Newbie
Posted: 04 April 2013 04:52 AM   Total Posts: 9

Hi,

I used Prefab to export a .awd file using the AWD2 format. My textures are embedded in the file.

Can someone please point me to step by step instructions on how I use this file? Do I use a Loader3D object and then the loadData method? I don’t want to load my .awd file at runtime, I want to embed it.

Thanks!

   

Avatar
Fabrice Closier, Administrator
Posted: 04 April 2013 09:17 AM   Total Posts: 1265   [ # 1 ]

Look in examples on git. Many are embedding awd’s.
But if you embed, why not use the AS3 exports instead? Init is faster and no loaders are required. a simple import + scene.addChild(new myClass()); is enough…

   

DorkBot, Newbie
Posted: 24 April 2013 04:13 AM   Total Posts: 9   [ # 2 ]

Thanks for you help. We are doing as you recommended. We are using prefab to export an AS3 class instead of an .awd file, and it works well. But we are having issues with lighting. In PreFab we have set point lighting and directional lighting but are unable to see it when testing the swf. We see the 3d object but with no shadows or light. Can you point us in the right direction please?

Thanks!

   

Avatar
Fabrice Closier, Administrator
Posted: 24 April 2013 12:36 PM   Total Posts: 1265   [ # 3 ]

The class that you exported comes with a demo project class.
If you would compile using the project class, all would look as in Prefab.
This class is there only to show you how to implement in your project. Every project has different needs, structure etc… that’s why the project class is limited to show how you can implement your class (the one you gave a name to) into your own project. You can of course copy paste all the data for lights, animations, skybox etc.. to your project.

If you use only the class that you named, it will recreate only what was exported for this specific class as an ObjectContainer3D holding meshes and their materials/methods.

   

DorkBot, Newbie
Posted: 25 April 2013 12:37 AM   Total Posts: 9   [ # 4 ]

Hi,

We used the demo class as a document class for a Flash Pro document. We are able to see the 3d object and rotate it, but we don’t see any lighting. We set the lighting points in prefab. And we see the lighting code in the demo class and confirmed that it is getting set up (the lighting init method is getting called).

Could we have not set the lighting points in prefab correctly?

Is there a walkthrough for setting up lighting points in prefab, exporting a class and then instantiating it in Flash?

Thanks!

   

Avatar
Fabrice Closier, Administrator
Posted: 25 April 2013 07:22 AM   Total Posts: 1265   [ # 5 ]

If you have defined lights and exported as AS3, with project/lights option on, it should result in same result as in Prefab.
However, due to new mods in the to become beta 4.1. If you export AS3 for 4.1 (you run your project on the dev branch), If you use pointlights, if you left the default setting to max in Prefab for them, the default Number.MAXVALUE stored into the as3 class will cause a black rendering. Either change the values for radius and falloff in the output class or in Prefab. This will be fixed in next update.

If you have a project with all lights set and the exported project class doesn’t reproduce the same lighting and its not caused by the above: Please, send me offline at fabrice3d at gmail dot com your project file+your target version (4 or 4.1) so I could test/fix what is possibly going wrong. If your project is big—> send me download url.

   

DorkBot, Newbie
Posted: 04 May 2013 03:45 AM   Total Posts: 9   [ # 6 ]

Hi,

I don’t fully understand what you are describing in PreFab. We are using the newest PreFab and we have adjusted the lighting in PreFab and also in the project class.

Would it be easier for use to work with an .awd file instead? How does lighting work for an .awd file? Is it still applied from an outside class?

We are working on a project that will eventually be a tablet app for iOS. I believe that AIR can’t load external files in iOS, and we can’t find an example of embedding a .awd file.

I’m going to send you the project files.

Thanks!

   

Avatar
Fabrice Closier, Administrator
Posted: 04 May 2013 09:04 PM   Total Posts: 1265   [ # 7 ]

If you are planning to publish on mobile, as3 is the best way to go, especially because of the asd’s. Project init faster and uses less memory than any other format available in away3d, inclusive awd. This is not because awd is not good, far from that. It is because there is no loader3D involved using Prefab’s AS3/asd’s. Embedding doesn’t change that.
Games like DeltaForce do use the asd/as3 combo and no embeds, because of this.

Currently awd 2.0 spec doesn’t support lights anyway, so you will need to define everything by hand again. Awd 2.1 will probably support lights and more (more news in just a few days…)

Embedding is exact same as loading any model in away, except you use loadData method instead of load. Take a look at our example repo, most are using embeds.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X