Hi guys- so I’m working on some 3D biology stuff and running into the ages old issue of my imported models being backwards/mirrored since Away3D is a left-handed system. I know that a hacky fix is to scale to -1 across the x-axis. While that hack corrects orientation, I’ve had and seen many others report problems then with shading and lighting on the object. So since it looks like this will ALWAYS be an issue with Away3D, what is the CORRECT way once and for all to get an imported model that is backwards to be 100% right in Away3D? Maybe we could have a sticky in the forum for this if there is really a correct way to do it?
bassackwardness lefthand vs righthand -1 scaling etcSoftware: Away3D 4.x |
||
|
||
Richard Olsson, Administrator
Posted: 14 October 2011 06:05 PM Total Posts: 1192 [ # 1 ] If you are using a file format which dictates the coordinate system of it’s content (e.g. AWD2, AWD1, 3DS, AC3D, OBJ) the parser should automatically convert it so that it looks right in Away3D. If you are using a file format where the axes are ambiguous then for obvious reasons this cannot happen automatically. In these cases, try doing a Geometry.applyTransform() with a Matrix3D that is scaled negatively on those axes that you need to flip. We are considering wrapping this trick into some utility class, but at the moment you have to do it manually. |
||
|
||
Tim Knip, Moderator
Posted: 15 October 2011 01:58 AM Total Posts: 7 [ # 3 ] Having the exact same problem with the COLLADA format with my DAEParser https://github.com/away3d/away3d-core-fp11/pull/140. Now, not to bug and of course understanding the implications… Now, why is Away in the - ahem - wrong space? It would save all of us a lot of headaches if Away3D would decide to ‘conform’. Also because it seems a reasonably easy fix, as its afaik mainly a projection thing. Maybe I’m underestimating the problem of moving to other coordinate system. But maybe it could be considered for 4.0. My 2 cents. |
||
Choons, Sr. Member
Posted: 15 October 2011 02:11 AM Total Posts: 281 [ # 4 ] actually Unity3D & DirectX itself are left-handed coordinate systems like Away3D as well so it’s not an unusual issue, but yeah I agree it’s weird that the top 3D modeling programs are all right-handed and the top game engines are all left-handed. Go figure?? So it’s better to just accept that there’s no real standard and concentrate on the best way to do the conversions, I think. It sure is one of those “WTF?” things about the 3D CG world. |
||
Richard Olsson, Administrator
Posted: 15 October 2011 06:29 AM Total Posts: 1192 [ # 5 ] It shouldn’t really be a problem. The parser should convert if necessary (that’s your job, Tim, and if you need help let me know) and the programmer should never have to care about it. Choons, if you are having problems, please explain what file format and what generator you are using, and if possible send me the file (preferably containing text or something like that so it is clear that it is flipped.) If it is one of the file formats that explicitly define the coordinate space (including 3DS, standard OBJ, DAE, AWD et c) then it’s either a bug in the encoder or in our parser, and we will want to get to the bottom of it. If it’s a bug with our parser, we will fix it. So please do not settle with a problem thinking “that’s just the way it is”. Because in most cases it shouldn’t have to. |
||
Tim Knip, Moderator
Posted: 18 October 2011 03:09 PM Total Posts: 7 [ # 6 ] Solved! (at least for DAEParser). Do this to your transforms:
/** Then for all vertices of your geometry:
v.z = -v.z;
Don’t forget to reverse the winding of the triangles! Thank you Richard Olsson! |