3DS Model Scaling

I have a quite similar problem with most of my 3ds files that I created some years ago. I can load them correctly in MAX, but not in JME.



First of all, some chunk ids are not implemented (UV offsets and UV rotation), so I added some code to simply skip these chunks, as I am not yet interested in correct texture mapping.



However, the main visual problem is that the model's components/objects are stretched!

I suspect there is a bug in TriMeshChunk.readCoordSystem(). It loads a 3x3 matrix and puts it into a jme.math.TransformMatrix that (as far as I can see) assumes an orthogonal matrix. However, this matrix called "rotation" is not a rotation matrix and not orthogonal: it's vectors are not of length 1 and not orthogonal.



I'm not sure why this 3x3 matrix has to be transposed (inverted?) and then inverted again in TDSFile.putChildMeshes. However, the translation and scaling (always 1?) are only inverted once. Why?



Separating rotation from scaling in the 3x3 matrix in readCoordSystem (which I could only do for orthogonal vectors) fixed the scaling and rotation problems, however the positions are still wrong.



I am giving up for today. Maybe someone of the 3ds model loader coding experts can have a look at the code. The initial post may be a starting point to reproduce this problem. I can also create a link to my 3ds files (as soon as I have figured out where to upload them).



Thanks a lot for reading. :slight_smile:

I haven't ever had a problem with my 3ds models loading (pretty much all I use)… Could you post a 3ds file that's causing you problems?  I'll see if I can figure out what the problem is.



timo

http://www.hobbytouren.de/temp/tom/jme/testfile.3ds

http://www.hobbytouren.de/temp/tom/jme/testfile.3ds.jme



Should be a nice looking airplane… works in my old MAX version. The model was created with Maya, imported in MAX and exported as 3DS.



Which 3D modelling software do you use?

Thanks a lot!

I use 3DS for everything.  I have done work in Blender and Vertex3D (http://wolfpack.twu.net/Vertex) a little Daz3D and even some TrueSpace4, but I always go back to 3DS.



I'll load these up and see what I can find out.



timo

I have found out how to correctly visualize my 3DS models just as MAX does, well I am taking about geometry only, no textures! :slight_smile:



It is only a workaround that prohibits animations, but that is OK for a start.



The key is that the 4x4 matrix loaded in readCoordSystem() is already applied to the position of the vertexes in the 3DS file and must not be applied by the 3DS loader once again.



So, I set an identity rotation matrix, neutral scaling and translation in readCoordSystem(). Then, I removed the code that is applying the matrix in TDSFile.putChildMeshes (although not necessary). So, all scalings are correct, still the positions are wrong, although they should be correct. What about the SpatialTransformer stuff… I removed the putTranslation method and the SpatialTransformers, although they get identity quaternions, scalings, translations as expected and voila, everything works!



Well, either MAX is producing bad models, which I really doubt, or the JME loader is broken.



If JME wants to use the matrices to apply the inverse on the object and reapply the transformation in SpatialTransformers, it must be able to handle nonorthogonal matrices (see above).

Furthermore, the SpatialTransformers must not transform an object on identity transformation parameters.