Skip to main content
gamedev.net
🔒 Locked

3DS format - LCS/pivot problem

Started by Megelan Jun 28, 2004 at 3:38 PM 2 replies 1.7k views
Original Post
Megelan
Megelan
Hello ! Please only answer if you have knowledge about the 3DS format. I know that it's an old format so please no comment like this ;) And sorry for my (maybe) bad english. :o) Some years ago I wrote a 3DS file format loader for my 3D engine. This loader process all chunks of the material, object and keyframer block. Now my a description of my problem : ------------------------------------ In the 3DS file format (which is a set of chunks) there is a chunk 0x4110 which has all the vertex points of a mesh in world coordinates. But these world coordinates are not the same like they are in 3DS Max when the pivot point of the object is not at the default position. So all objects which have still their default/reset pivot point are correctly shown in my engine. But when I translate or even rotate the pivot point of an object in 3dsmax and export it to 3ds, the vertices in chunk 0x4110 are modified in some way. I know the pivot adjustment vector in the keyframer block chunk 0xB013 and the LCS (Local Coordinate System) Matrix in the Object block chunk 0x4160 are the keys to recalculate the vertices and finally get the vertices looking the same like in the 3ds max editor. I hope you already know my problem ? :) Please let me know how to do it. I was working on this so long but there are no documentations about how to use the LCS matrix and the pivot adjustment point (from the keyframer) together with the world vertex points to get the final right vertex points. What's the trick ? For example if I rotate the pivot point in 3dsmax and use the vertices from the vertex list chunk the whole object is rotated. I already tried to multiply each vertex point with the normalized LCS matrix but this only works in some special cases. Also the position isn't correct. Can you help me please that would be very nice and friendly from you. I hope so much you can help me with this. I need some description how to always get/calculate the right world vertices even if the pivot point was translated or rotated like hell in 3ds max. Thank you for your time I'm really looking forward your answers. Best greetings, Megelan
Megelan
Megelan
I am only trying to render frame 0 at this point in time.
If you can see what I am doing wrong or just want to suggest something please do.

1. Flip Y with -Z for all vertices (0x4110)
2. Flip y with -z components of the x,y,z LCS vectors (0x4160)
3. Flip complete y,z LCS vectors
4. Build LCS matrix from these x,y,z + translation axis with
translation vector in the rightmost column
5. This steps build up my LCS matrix

--- Now if I debug until here and look on the LCS it's exactly
--- the same like the Local Coordinate System around the objects
--- pivot point in 3ds max

6. Invert LCS matrix, transpose will do (matrix is orthogonal)
7. Flip Y with -Z components in keyframe positions. (0xB020)
8. Flip Y with -Z components in keyframe rotations. (0xB021)
9. Multiply each vertex with the inverse LCS matrix (from 6.)
but normalize the rotation part of this matrix cause I
don't care about the scale-keyframer track
10.Rotate the object with the rotation matrix from the
first rotation track key


Now my object looks nearly the same like in 3ds max
except that its vertices x-values are flipped.


Here is a test file, maybe you can load it with your
3ds loaders (if you have one) and compare :

http://user.cs.tu-berlin.de/~magnusch/3ds_LCSmatrix_And_Pivot_TestModel.3DS

Please can anyone tell me what I'm doing wrong ?
Big thanks !
benishor
benishor
too tired to explain..

http://www.geocities.com/SiliconValley/Bay/6525/

take a look at clax. it'll clarify your problems
---novocaine thru yer veinz

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.