I cannot use prefab because the obj files that the swf loads are automatically generated and loaded at runtime. So editing those with prefab is not possible.
The invertFaces works great. Thanks! Even if i could edit those obj files in prefab i would not prefer to do this. The obj is perfectly valid and loaded by the loader. Only the scaleX = -1 happens to break backface culling in away3d. And besides all that obj loading the same problem exists for actionscript generated mesh objects. I don't think this is expected behavior. If you scale an object this should not affect the backface culling algorithm for that mesh. On Aug 28, 10:09 pm, Fabrice3D <[email protected]> wrote: > > I cannot use Prefab for this. It has to be an actionscript solution. > > Prefab converts your obj file to as3 (after you have flipped it). More As3 3D > than this you will not find :)) > > so instead of Obj.load("myFile.obj"); > you do import PreFabClassFromMyObj and add it to your scene > scene.addChild(new PreFabClassFromMyObj()); > > sauce = you drop on Prefab --> scale --> revert --> export to as3 --> you > import this class in your project. > > > i cannot find a method Mesh.revertFaces > > Oops, myMesh.invertFaces > > Fabrice > > On Aug 28, 2010, at 9:01 PM, Michael Klostermann wrote: > > > Thanks for the quick reply. > > > I need an actionscript solution to this. I am using the latest svn > > trunk source code r2757 and i cannot find a method Mesh.revertFaces > > > On Aug 28, 8:14 pm, Fabrice3D <[email protected]> wrote: > >> You could load your obj in Prefab, scale it -1, and use the revertFaces > >> fonction from menu, and export as as3 or awd. > >> You then import the awd exact same way as you do for your obj file, except > >> you use the AWData instead of Obj. > >> Using the AS3 export, just import this class and scene.addChild(new > >> myClass()); > > >> In Away via code, if you do not want to use Prefab, you can after your > >> scale -1, use Mesh.revertFaces(); > > >> Fabrice > > >> On Aug 28, 2010, at 5:22 PM, Michael Klostermann wrote: > > >>> Hi all, > > >>> i have a problem with backface culling not working as expected. > > >>> I ran into this problem because i needed to load an obj file. After > >>> the loading the object is perfectly rendered but the model is mirrored > >>> on the zy-plane. In order to fix this i tried mesh.scaleX = -1. Now > >>> the rendered model shows only backfaces. Setting bothsides to true > >>> does not work well for performance and other reasons. So i think i > >>> would need to find out a way to mirror an object along the zy-plane > >>> without using scaleX = -1. I do not know very much of the internals of > >>> away3d. In opengl i would think that backface culling uses normals. > >>> Flipping those would work in theory but i have not found a way to do > >>> this in away3d. Does someone have a solution to this? > > >>> I also created an issue on google code for this since it does occur > >>> also on actionscript created objects: > >>>http://code.google.com/p/away3d/issues/detail?id=129 > > >>> cheers, > >>> Michael > >
