PDA

View Full Version : 3D object format conversion



JanHH
04-22-2003, 04:14 PM
Hello,

I am working on a 3D engine that has to render objects, which are designed with 3ds max. The 3d engine has support for alias wavefront .obj implemented, due to its easy ascii readability. But there does not seem to be a really working .max -> obj export.. or does anybody know how to do this without getting the texture coordinates messed up (as this is what alway happens)?

Also, are there other 3d file formats that are well supported under linux? Probaly any libraries that can be used easily? Just ANY way to get the .max objects renderd properly?

Kind Regards,
Jan

zen
04-22-2003, 05:13 PM
I don't know anything about max to obj conversion but you might want to look into lib3ds which will allow you to read 3ds files pretty easily. You can then export max objects into 3ds files. Texture coords should work but I'm not so sure about normals though.

PS: I keep reading (esp. on the beginners forum) that ascii files are easier to read than binary ones? For humans maybe but it should be much 'harder'(as in resulting in messier code) to read ascii data for a computer. You should not be afraid of binary data, it's just a bunch of numbers like ascii. For example a simple binary geometry file could be read in a few lines of code.Like:
Read header,etc;
read(fd, vertexarray, n1);
read(fd, normalarray, n2);
read(fd, coordarray, n3);
read(fd, colorsarray, n4);
read(fd, indexarray, n5);
with n1 through n5 beeing 'calculated' from the header and the read arrays ready to be used by a glDrawElements call.With an ascii file you'd have to parse each line , decide what it means and then convert all the ascii numbers to binary.Definately not that simple. What I wanted to get at is: is there any other virtue of ascii files(besides being too big and slow to load) of any use that escapes me? I heas doom3 md5 files are going to be ascii.

[This message has been edited by zen (edited 04-22-2003).]

JanHH
04-22-2003, 05:22 PM
You're certainly right with the binary files, ascii files are only better at being readable by humans, and in conclusion to this, making it easier for beginners to implement import functions.

The Problem with lib3ds might be the same as with the obj export, which is that the texutre coordinates seem to get messeed up in the max->3ds export step, not in the 3ds->obj export. and there is no "libmax", isn't it? I guess that max itself is rather hard to implement?

Jan

zen
04-23-2003, 07:53 AM
Are you sure about that texcoord issue? I only have had some problems with normals but I suspect they're due to the initial model, not the export proccess.

JanHH
04-23-2003, 09:31 AM
Yes I am sure about the texture coordinates issue.. when exporting an object from max as .3ds and viewed with another program, the tex coords are broken, textures are messed up. I really can't believe that 3ds max is unable to export a textured object correctly to the .3ds format, but it really seems to be the case.

zen
04-23-2003, 10:27 AM
Maybe that other program has the bug. Better check again...

JanHH
04-23-2003, 01:36 PM
saved the object to .obj directly from max with a obj export plugin (which always causes max to crash), and there also the tex coords were messed up. I really think that max is unable to export uvw mapping with modifiers to other formats.