jPCT can't load instance objects in 3ds file?

Started by qjvictor, November 29, 2006, 04:01:02 PM

Previous topic - Next topic

qjvictor

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?

EgonOlsen

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... :?:

qjvictor

The instance of object exists when I open the 3ds file with other tools like 3D Exploration, but is missed when loaded by jPCT.

EgonOlsen

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...

qjvictor

Ok, I will send you the 3ds file immediately.

EgonOlsen

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.

cyberkilla

http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

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.

qjvictor

Yes, Egon is right.
It seems that it is a common problem for many 3d viewers and 3d engines to deal with instanced objects.

raft

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

r a f t

qjvictor

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

raft

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

r a f t