View Full Version : ASE normals loading problem
10-19-2000, 10:15 AM
I created a ASE file loader with doc found on www.wotsit.org (http://www.wotsit.org) one month ago. It works fine but normal aren't right, it loads the right value that 3DS Max gives but it doesn't work. I switch the y and z value as written in the doc and invert the z then.
I tried many files from 3DS MAX 3.0 and 2.0 but I've got the same result.
Any iD? anyone did a loader which works? any URL?
That took me a while to figure this out !
You know, for each object, you have a Transformation Matrix like this:
*TM_ROW0 1.0000 0.0000 0.0000
*TM_ROW1 0.0000 1.0000 0.0000
*TM_ROW2 0.0000 0.0000 1.0000
*TM_ROW3 0.0000 0.0000 0.0000
You need to multiply the normals of the file by the transpose of this matrix !
And then everything is fine...
10-20-2000, 12:35 AM
Thanks Eric but it doesn't work definitely.
I load the matrix, let's take your example :
/* for TM_ROW0 */
transform = 1.0f; transform = 0.0f; transform = 0.0f;
and so on for the rest of the row then I multiply each vertex and normal like this :
vertices[faces[index].vertices[i]].normal[X] = transform * fx + transform * fy + transform * fz + transform;
when fx, fy and fz are value read from file for a normal.
Am I doing the right multiplication? or am I wrong?
That's how I do it:
The transform matrix is a GLdouble;
When you parse the ASE file, fill the Matrix array like that:
Then, you have an "OpenGL" matrix (these are the indices of your Matrix array):
[ 0 4 8 12 ]
[ 1 5 9 13 ]
[ 2 6 10 14 ]
[ 3 7 11 15 ]
That's why I meant 'transpose' (what they call "ROW" in ASE file is a Column for us !).
Now, for each normal that is in the ASE file (u,v,w), you obtain the proper normal (ru,rv,rw) like this:
Now, to display your object, simply start with a glTranslated that will bring your object in the correct position:
Then send your vertices like they are in the ASE file (THEY ARE ALREADY TRANSFORMED BY THE GIVEN MATRIX !) and send the normals as we just calculated them.
It definitely works !!!!
10-20-2000, 04:22 AM
now it's working but I've got to rotate the mesh around the Y axis (90 °)
the main goal is reached, I can import ASE file.
Thanks a lot for spending time with this little problem.
You said you switched Y and Z components and inverted the Z when loading the normal. This has to be done with all vertices you load aswell, because the whole coordinate system in MAX is like this, Z is up instead of "into the screen" as in OpenGL. This is why you need to rotate the model to get it right.
Yes, I forgot that: in my programs, Z is always going up.... Don't ask me why, I just think it feels better (hey, altitude is always expressed on the Z axis !).
I am glad you have your import working !
10-20-2000, 04:35 PM
Can you tell me where did you find ase format description? I tried to find it on wotsit.org but it isn't there.
I basically saved a few easy models (a cube, a sphere, a group containing both, ...) with 3DS max into ASE format... Then I opened the files with Ultra-Edit32 and I understood the format pretty easily...
I know most of people here have done exactly the same !!!
Yeah, I agree with you Eric, that's what I did too. Just open the file and have a look. No description needed.
10-23-2000, 03:33 AM
What is Ultra-Edit32? is it a software ? where can I download it ?
Thank you for the moment
Just use any standard text editor. ASE files are just text, that's what makes them so nice.
Ultra-Edit32 is a text-editor available at www.ultraedit.com. (http://www.ultraedit.com.) It features a 30-day trial only... Then either you buy it, either you reinstall it... That's boring but I used it for editing ASE files with a 30-day trial period... I am thinking about buying it now !
10-24-2000, 01:21 AM
Sorry I thought that it is a special editor, sorry for the stupid question.
Thank you guys.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.