Handling separate objects & groups during .3DS import

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

Handling separate objects & groups during .3DS import

Post by KevinCain »

1. Using Irrlicht v1.1, can object groups in .3DS files be preserved when loaded into Irrlicht?
2. What is the best technique for loading multiple (separate) meshes in Irrlicht from a single 3DS file?

I could be missing a general grouping / mesh hierarchy implementation in the Irrlicht scenegraph--but I can't seem to find any information on that by searching the forums.

Ideally I would like to be able to extract multiple meshes from a single .3DS file, preserving grouping information where present in the source file, so that I can build an integrated scene viewer.

Many thanks for any words of advice!

-Kevin
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

A 3ds file only holds one mesh. Groups are not meshes.
r-type
Posts: 41
Joined: Sun Feb 12, 2006 1:54 am

Post by r-type »

A 3ds file does hold objects , although the importer would be kinda messy to alter to have it make multiple meshes out of it or even place ready made scenenodes. But the information's there
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

Objects vs. meshes in the Irrlicht scenegraph

Post by KevinCain »

Thanks, Hybrid!

Since you have contributed your own (excellent) extensions to the Irrlicht .3DS file importers, you understanding in this area is second to none.

Forgive me for such a basic question, one I thought I understood the answer to already.

I understand from your reply that Irrlicht loads a .3DS file as exactly one mesh. However, since a .3DS file can of course hold more than one object (and these objects may be grouped), how is it possible to load each object in a .3DS file individually--i.e., load each object as a separate mesh in Irrlicht?

I'm certain that a great many strategies already exist for handling multiple meshes in Irrlicht--I'm asking if there is a way to preserve the contents of a .3DS file without writing another importer.

-Kevin
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

Post by KevinCain »

Thanks, r-type,
r-type wrote:A 3ds file does hold objects , although the importer would be kinda messy to alter to have it make multiple meshes out of it or even place ready made scenenodes. But the information's there
Yes, that's the information I'd like to preserve.

To illustrate the point with a trivial file (<5kb), here are three separate objects, segmented into one group in the .3DS file here:

www.insightdigital.org/irrlicht/3-shapes-1-group.3ds

To contrast, here are the same three separate objects, ungrouped:

http://www.insightdigital.org/irrlicht/ ... colors.3ds

One workaround, of course, is to batch export each separate object I need from an interim program like Maya. However, this is less than optimal: to describe a scene with 200 objects / layers would require 200 files, and there is no easy way to denote in those 200 files which are grouped, except via metadata of some sort.

Thanks!

-Kevin
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

But there's a difference between meshes (as in Irrlicht) and trimeshes in .3ds. the latter are merely meshbuffers in Irrlicht. However, you cannot identify objects in 3ds with meshes in Irrlicht, because the hierarchical structure of the objects require that all objects are part of one mesh in Irrlicht. The same holds for animated meshes, which are based on several objects which are connected and animated. This can only be achieved (and only makes sense) if we talk of one object (mesh) in Irrlicht. Objects are just separate entities inside 3ds files.
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

mesh buffers

Post by KevinCain »

hybrid wrote:...the hierarchical structure of the objects require that all objects are part of one mesh in Irrlicht. The same holds for animated meshes, which are based on several objects which are connected and animated.
Thanks once again for a quick reply, hybrid!

You're quite right, of course, but my question is then: how can I load separate objects as separate mesh buffers in Irrlicht? If I use getMeshBufferCount after importing a 3DS file, it should reflect the number of objects. However, I can't find a way to manipulate (hide / show / xform) each mesh buffer. This is what I'm seeking--a way to manipulate as separate mesh buffers the separate objects from the .3DS files.

What about preserving grouping information from the .3DS file in a way that I can recover and use in Irrlicht?

Thanks once again,

-Kevin
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The hierarchy information in 3ds files is quite complex, animation is even not started for the Irrlicht loader. But all objects should definitely go into separate meshbuffers if they don't do as such already.
However, access to meshbuffers is not really as simple as you might want it. They don't have names, the ordering is defined by each loader separately. In most cases access to meshbuffers is done uniformly across all buffers. See the MeshManipulator class for this case. Any other technique will require lots of additional code changes to Irrlicht's core classes to support this - or a specific mesh class for 3ds files. The latter seems to be quite common for animated meshes.
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

Post by KevinCain »

hybrid wrote:...access to meshbuffers is not really as simple as you might want it. They don't have names, the ordering is defined by each loader separately. In most cases access to meshbuffers is done uniformly across all buffers.
Thanks, this is useful.

If mesh buffers aren't named and access is done globally for all buffers, is a better way to approach hundreds of separate objects to load them as separate meshes?

Is it common/possible in Irrlicht to manage hundreds of meshes in the Irrlicht scenegraph?

Thanks again,

-Kevin
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

That shouldn't be too bad compared to hundreds of mesh buffers. You will even get better culling with lots of mesh buffers.
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

Multiple meshes

Post by KevinCain »

Based on what hybrid has written, it seems I should abandon the idea of importing a single .3DS file containing many separate objects in Irrlicht, in favor of a 'one object per file' approach.

Perhaps Collada makes sense, since (as I understand it) Irrlicht will read multiple objects from Collada format into the scenegraph as separate entities. I don't know if grouping is supported, though, in Collada.

In the worst case, I can write an standalone exporter from a 3DS file with multiple objects to multiple 3DS files with one object each. I'm just trying to avoid that, since it seems less than elegant as a solution. ;-)

-Kevin
scotte
Posts: 3
Joined: Thu Oct 26, 2006 5:56 pm

Post by scotte »

If possible try using the my3d file format if you're going to export multiple meshes from one scene to load into irrlicht. The 3DS file format seems to corrupt the meshes(s) position as they relate to each other... So what used to be on top of each other is now side by side. At least this is what happened with my 3ds files that were exported from 3dsMax8.

As for the Collada format... I havent' been able to get anything veiwable with this schema.
Post Reply