How to invert faces?

Software: Away3D 4.x

maricate, Jr. Member
Posted: 02 July 2013 07:17 PM   Total Posts: 36

I tried everything.
I am having difficulty in reversing the faces of a model in which the materials are applied.
I used Maya to export an OBJ and then prefab3d to export a awd (version 1).
I tried to reverse the faces by maya and then export, but it did not work.
Could anyone help me?

   

Avatar
80prozent, Sr. Member
Posted: 02 July 2013 10:39 PM   Total Posts: 430   [ # 1 ]
MeshHelper.invertFaces(yourMesh); 

i think that should do the job…

but would be better to solve this on the exporter-side…..

 

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

Avatar
Fabrice Closier, Administrator
Posted: 02 July 2013 10:48 PM   Total Posts: 1265   [ # 2 ]

if you export from Prefab (mouse right click), inverse faces. Then use awd2, not 1.

   

maricate, Jr. Member
Posted: 02 July 2013 10:56 PM   Total Posts: 36   [ # 3 ]

Tks 80prozent, your tip works for now… :)

Fabrice Closier, im using prefab but no object I export using version 2 of the awd works.
Even using the correct parser to import.
I’ve tried several ways but the version awd2 not work with me.
Not even the prefab reopens awd2 it exports.

   

Avatar
80prozent, Sr. Member
Posted: 02 July 2013 11:05 PM   Total Posts: 430   [ # 4 ]

hi

its was my tip, but i believe fabrice wrote the invertFaces function smile

i just tried saving a obj to awd2 with prefab, and had no problem.
I didnt tried any textures….

 Signature 

sorry…i hope my actionscript is better than my english…

   

maricate, Jr. Member
Posted: 03 July 2013 12:02 AM   Total Posts: 36   [ # 5 ]

Im using prefab 2.143 on Montain Lion…
AWD2 export works, but the file can not be imported.
Not even in prefab I can open or import the file the same prefab exported.

   

Avatar
80prozent, Sr. Member
Posted: 03 July 2013 12:17 AM   Total Posts: 430   [ # 6 ]

i am using same version, but on windows…..

strange. for me its working without problem.
just imported it again….all fine

when importing (or trying to) the file, have you had a look at the Process Log ?
Windows->ProcessLog

maybe its telling something about errors there ?

[edit: also, i am using the default export-settings for awd2, so for testing you should do that too….just to make shure its not a bug within one of the settings…]

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

Avatar
Fabrice Closier, Administrator
Posted: 03 July 2013 08:40 AM   Total Posts: 1265   [ # 7 ]

@maricate. I’m mac based too, tho not on latest OSX. Indeed if there is an AIR/OSX issue, I would like to know what is going on in order to fix for next release.
So if you could, please send me (fabrice3d at gmail dot com) your exact steps 1 by 1 for your export (screendumps+comments), and eventually the exported awd. Thanks by advance.

   

maricate, Jr. Member
Posted: 03 July 2013 05:59 PM   Total Posts: 36   [ # 8 ]

@ Fabrice: I sent you an email… tks again…

@ 80prozent: What classes you are importing and what parser are using to be able to import AWD2?

   

Avatar
80prozent, Sr. Member
Posted: 04 July 2013 12:44 AM   Total Posts: 430   [ # 9 ]

Just look at the Polarbear-example on github
https://github.com/away3d/away3d-examples-fp11/blob/dev/src/Intermediate_PolarBearAWDAnimation.as

use either the assetlibrary or the loader3d for importing.

you can either set the

Parsers.enableAllBundled() 

to have the classes autoselect the correct parser to use,
or you can set

AssetLibrary.enableParser(AWD2Parser); 

or

Loader3D.enableParser(AWD2Parser); 

to make shure only the AWD2parser is used.

Hope that helps

 Signature 

sorry…i hope my actionscript is better than my english…

   

maricate, Jr. Member
Posted: 04 July 2013 06:07 PM   Total Posts: 36   [ # 10 ]

Nop… i get a lot of errors in AnimatorBase.as :(

   

Avatar
80prozent, Sr. Member
Posted: 04 July 2013 11:28 PM   Total Posts: 430   [ # 11 ]

Hi

if you are trying to load your (not animated model) into the Polarbear-example instead of the Polarbear.awd, it will not work.
The polarbear.awd contains skeletonAnimation, and the example will not work without it. I only meant you should have a look at how the example sets up the assetlibrary to load the file, not how the example is handling the file after loading.

this is the code thats telling the assetLibrary to autoselect the parser to use, and than to load a file

Parsers.enableAllBundled()
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete);
AssetLibrary.load(new URLRequest("assets/PolarBear.awd")); 

than the onAssetComplete is executet for each asset that is constructed.
there are assets of differentTypes (mesh/geometry/material etc) and in this function, you check the type of the asset, and than you know what to do with it. with most of the assets you do not need to do anything, but when using the assetlibrary, you need the root-objects(objects that are no childs of other objects) to the scene. here is how you would do that for mesh and objectContainer3d, but there are some other assets you would need to add to the scene, if they are stored in the file (Skybox,Textureprojector, camera3d)

private function onAssetComplete(event:AssetEvent):void
{
    
if (event.asset.assetType == AssetType.MESH{
        
if (!Mesh(event.asset).parent)
            
scene.addChild(event.asset);}
    
else if (event.asset.assetType == AssetType.CONTAINER{
        
if (!ObjectContainer3D(event.asset).parent)
            
scene.addChild(event.asset); 
            
    } 


hope that helps

 Signature 

sorry…i hope my actionscript is better than my english…

   

maricate, Jr. Member
Posted: 05 July 2013 06:12 PM   Total Posts: 36   [ # 12 ]
80prozent - 04 July 2013 11:28 PM

Hi

if you are trying to load your (not animated model) into the Polarbear-example instead of the Polarbear.awd, it will not work.
The polarbear.awd contains skeletonAnimation, and the example will not work without it. I only meant you should have a look at how the example sets up the assetlibrary to load the file, not how the example is handling the file after loading.

this is the code thats telling the assetLibrary to autoselect the parser to use, and than to load a file

Parsers.enableAllBundled()
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete);
AssetLibrary.load(new URLRequest("assets/PolarBear.awd")); 

than the onAssetComplete is executet for each asset that is constructed.
there are assets of differentTypes (mesh/geometry/material etc) and in this function, you check the type of the asset, and than you know what to do with it. with most of the assets you do not need to do anything, but when using the assetlibrary, you need the root-objects(objects that are no childs of other objects) to the scene. here is how you would do that for mesh and objectContainer3d, but there are some other assets you would need to add to the scene, if they are stored in the file (Skybox,Textureprojector, camera3d)

private function onAssetComplete(event:AssetEvent):void
{
    
if (event.asset.assetType == AssetType.MESH{
        
if (!Mesh(event.asset).parent)
            
scene.addChild(event.asset);}
    
else if (event.asset.assetType == AssetType.CONTAINER{
        
if (!ObjectContainer3D(event.asset).parent)
            
scene.addChild(event.asset); 
            
    } 


hope that helps


So AWD2 files are only for animations?
Sorry, but I’m still newbie in Away3D. I’m trying to understand the logic of some things.

 

   

Avatar
80prozent, Sr. Member
Posted: 06 July 2013 10:22 PM   Total Posts: 430   [ # 13 ]

Hi again
its like that:
Awd2 can contain animation, but the animation is only optional.
In the PolarBear-example, the example-code expects the imported mesh to be animated, and thus it chrashes if the mesh is not animated.
please have a look at some of the other examples found on github, and everything should start to get more clearer…

 Signature 

sorry…i hope my actionscript is better than my english…

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X