Author Topic: jPCT can't load instance objects in 3ds file?  (Read 4476 times)

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
jPCT can't load instance objects in 3ds file?
« on: November 29, 2006, 04:01:02 pm »
in my 3ds file, some objects are instance objects, I found jPCT can't load this kind of objects by Loader.load3ds(), any way to load?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jPCT can't load instance objects in 3ds file?
« Reply #1 on: November 29, 2006, 05:17:03 pm »
Are instance objects actually part of the 3ds file format or are they getting lost when exporting to 3ds from max? I've three different specs for 3ds format on which the loader is based (as more or less complete) and none of them says a word about instances... :?:

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
jPCT can't load instance objects in 3ds file?
« Reply #2 on: November 29, 2006, 05:23:13 pm »
The instance of object exists when I open the 3ds file with other tools like 3D Exploration, but is missed when loaded by jPCT.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jPCT can't load instance objects in 3ds file?
« Reply #3 on: November 29, 2006, 05:26:50 pm »
Can you please send me an example file that shows the problem? But even then i don't know how to fix this. The 3ds format is binary...who knows how they store instances in that thing...

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
jPCT can't load instance objects in 3ds file?
« Reply #4 on: November 29, 2006, 05:32:24 pm »
Ok, I will send you the 3ds file immediately.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jPCT can't load instance objects in 3ds file?
« Reply #5 on: November 29, 2006, 06:31:27 pm »
Ok, i did some tests and loaded the model into various viewer/converter/editor tools. Here are the results:

DeepExploration 2.0: Loads and displays fine
Gile: Loads, but the instance objects are missing
Wings3D: Loads, but the instance objects are missing
Nameless OS viewer: Loads, but the instance objects are missing
jPCT (as already known): Loads, but the instance objects are missing

So the objects are obviously there but no application (that i tried) except DE can actually load them. I don't know how to fix this in jPCT because, as mentioned, i don't know where and how instance objects are stored in 3ds format. What worked for me was to load it into DeepExploration and export it back into 3ds. After that, all the other tools could load the file without problems and so could jPCT.

Without problems? Not quite...the file contains 3185 (in words: many!!) single objects. Merging them into one after loading (which is what you should do if you want performance) takes ages even on my not so bad Core2 Duo @3Ghz. You should consider to model them as one object instead somehow (maybe merging them with the fence object is possible? I don't know, i don't use MAX) or to serialize the Object3D after loading/creating it once.

P.S.: I'll send you the model converted by me to see for yourself.

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
jPCT can't load instance objects in 3ds file?
« Reply #6 on: November 30, 2006, 07:49:43 pm »
What the heck are instance objects?
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jPCT can't load instance objects in 3ds file?
« Reply #7 on: November 30, 2006, 11:18:18 pm »
Obviously the geometry data is stored once in the file and then placed at different locations, i.e. you have 1 object (instead of 2000 single objects for example) but 2000 positions for it.

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
jPCT can't load instance objects in 3ds file?
« Reply #8 on: November 30, 2006, 11:45:09 pm »
Yes, Egon is right.
It seems that it is a common problem for many 3d viewers and 3d engines to deal with instanced objects.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
jPCT can't load instance objects in 3ds file?
« Reply #9 on: December 01, 2006, 03:08:21 am »
if your concern is memory you may implement your own 'instance' mechanism as i do in karga: that is export only one object to a 3ds file and save locations of others to a text file and use them. or alternatively you can use dummy objects with one vertex (not sure if jpct will load them) to mark locations

Code: [Select]
r a f t

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
jPCT can't load instance objects in 3ds file?
« Reply #10 on: December 01, 2006, 04:14:52 pm »
save locations of others to a text file?   I don't know how to do this in 3ds max. could you please give me some details?
Thanks

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
jPCT can't load instance objects in 3ds file?
« Reply #11 on: December 01, 2006, 07:16:46 pm »
you can do it with max script. just save translation and rotation of each object with a proper format. there is one trick: you must take care of cordinate system transformation as 3dmax and jpct uses different systems

Code: [Select]
r a f t