Bug in .OBJ Format import (Beta 1.15)

Started by sbaltes, July 25, 2007, 03:26:56 PM

Previous topic - Next topic

sbaltes

I was very happy to see that the new version of JPCT can import Wavefront .OBJ files. Sadly it doesn't work with files exported from Poser 6 and / or Milkshape 1.7.9 and 1.8.1a. The first file results in an empty object, the other file results in an object that reminds a little bit of a hedgehog - it's very spiky.

You can download the files from this url - it's the same object, one from poser and the other one from milkshape (it's the poser .obj file loaded in milkshape and saved again as .obj with milkshape):

http://b1.world-of-dungeons.de/hose_milk.zip

This is the code I use to load the files:


Object3D[] o = Loader.loadOBJ(filename, filename.replaceAll("\\.obj", "\\.mtl"), 100f);
for (int j = 0; j < o.length; j++) {
  world.addObject(o[j]);     
}
world.buildAllObjects();


Thanks for any help!

EgonOlsen

Oh yes, OBJ...the format that looks like as if somebody has poured a model's parts across the whole file with a watering can...i'll look into it...

EgonOlsen

Ok, i've send a fixed version to you. Please let me know, if it works better.

cyberkilla

I report no problems, but I used Blender to do mine.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

The problem with OBJ is, that you have to understand one thing: Vertex definitions as well as texture coordinates are global no matter where they are located in the file. They appear in groups sometimes but they aren't grouped...but: When referencing to a coodinate/vertex from a group's face definition list, you can only reference to vertices already defined. If their definition comes later in the file, you can't reference them. So they are global...but not completely. It would have been a much better idea IMHO to put them at the beginning of the file outside of any group instead of spreading them all over the file...and every exporter does it differently...ARGHH!

cyberkilla

Damned annoying!

All of the examples I've seen, even on the specification documents, look like the output of Blender's exporter.

It is so typical of people to add complication just to avoid a few more lines of sorting code.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG