Author Topic: Bug in .OBJ Format import (Beta 1.15)  (Read 5289 times)

Offline sbaltes

  • byte
  • *
  • Posts: 5
    • View Profile
Bug in .OBJ Format import (Beta 1.15)
« on: July 25, 2007, 03:26:56 pm »
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:

Code: [Select]
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!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Bug in .OBJ Format import (Beta 1.15)
« Reply #1 on: July 25, 2007, 05:12:35 pm »
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...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Bug in .OBJ Format import (Beta 1.15)
« Reply #2 on: July 25, 2007, 05:35:34 pm »
Ok, i've send a fixed version to you. Please let me know, if it works better.

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Re: Bug in .OBJ Format import (Beta 1.15)
« Reply #3 on: July 26, 2007, 02:39:28 am »
I report no problems, but I used Blender to do mine.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Bug in .OBJ Format import (Beta 1.15)
« Reply #4 on: July 26, 2007, 08:17:47 am »
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!

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Re: Bug in .OBJ Format import (Beta 1.15)
« Reply #5 on: July 27, 2007, 04:56:45 am »
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