Is it Posible Loading separated mesh from one file ?

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.
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Is it Posible Loading separated mesh from one file ?

Post by radiant »

Well.. as the title says.... i have a single .3ds file but it contains a whole ambient, not just one mesh... using getMesh(file.3ds); just gives me 1 huge mesh in the screen, but in my project i need to display some info on diferent objects when selected, if i have just one huge mesh i cant tell wich object is being selected, thus i cant dysplay the corresponding info, is there any way to separate the objects in my .3ds ambient into separated mesh's from inside irrlicht or do i have to separate em outside and put one by one into the scene?

Thanks in advance
shogun
Posts: 162
Joined: Wed Sep 05, 2007 11:02 am
Location: inside

Post by shogun »

You probably want to use a scene format. Search for "LoadScene" and the .irr-format.
Otherwise, search the API for meshbuffers. With these you can get access to submeshes of a big mesh.
cyberion
Posts: 30
Joined: Tue Oct 23, 2007 5:53 pm

Post by cyberion »

Please take a look on my code :
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=27021

You can add in irrEdit :

* Mesh // no collisions applied
* OctTree // collisiona applied

And later give an unique ID or Name for each object and later from the code you can take an ID or Name from file.irr (it is XML try to open it in Notepad :)
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

OK, i think meshbuffers is just about what i was looking for, let me see if i got it right.... i create an IMesh from my .3ds file..... then check how many individual mesh's are in it (getMeshBufferCount()) and then i can accses em one by one using getmeshBuffer()

it doesnt sound so hard..... thanks for the reply
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

About the use of .irr files.... id really really like to avoid it ar least.... avoid using irredit cause the one making the models isnt me... what happends is this:

the proyect is some sort of navigator.... its gonna be used to check the design of electrical substations.... the "production pipeline" works like this...
someone (probably the client's workgroup) is making the 3d modelling in an architecture program(allplan) it has to be that program cause it has some features they need for other part of the proyect, then the models have to go... as directly as posible to the navigator.... so if i establish that the models have to come from irredit.... it means that they have to learn irredit, not only that.... it also means.... that the work has to be double.... makin the scene in allplan and makin the scene in irredit.... plus ... so far i havent been able to dislay any of the models from allplan in irredit.... it...loads but i cant see em...

anyway... thenks for the reply
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

You could make an .irr exporter in max script which exports your scene and all models separately, it could even export it twice, once for each toolset
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

Well.... that could be a solution..... still... i dun know how to make max exporters....

Thanks for the reply.... if u happend to know how to make the exporter or know any tutorial on how to make it... ill really apreciate it
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please note that 3ds might not be the best format for this kind of export. Because groups, hierarchies, etc. are not supported for that format. You could use .obj with the latest SVN trunk code. Gives you group support, very good material support, smoothed vertex normals, ... And there should be a pretty good export from MAX to .obj.
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

ok.... certanly it might be a good idea to change the file format for the proyect.... but as i mentioned earlier... im not making the models.... its true that its me who has to set the rules to make those models for them to run properly in the navigating app.... but there are a few things to be aware of:

Since this is not a home proyect.... if the models have to go through MAX... the client has to have an enterprise license for max... an since max isnt the prymari modelling aplication the ( not cheap at all) license would just be used to export from .3ds(allplan) to .obj or .irr or whatever format is needed, currently im using MAX for exporting on my work computer but id rather use blender for the final version since in blender i can import .3ds and its free so the client doesnt need to buy a expensive license just for exporting models, my problem is that so far none of the blender models dysplay correctly in my test apps... so... if its absolutely necesary... ill use MAX, but id rather not to....

having said that...

-Using blender: is there a way to export scenes to .irr ?

-Using MAX: is there a way to export scenes to .irr ?

if there is no way to do so... what file format would be best(of the ones exported by blender) to use with irrlicht?

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

Post by hybrid »

Well, Collada would be a way, because Collada also loads into scene nodes. However, there are still several bugs in the current SVN version of the loader. So I just cannot tell you when the loader will work correctly, but once you can load your models with it you will have them separated automatically (and blender does export Collada).
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

What do u men with... "colada does export into scene nodes"?

it creates a scene node for every model in the scene?

or it creates a IMesh and i get the diferent models using MeshBuffers ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, collada is a scene format, hence all Collada nodes are put into separate scene nodes in Irrlicht.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

pc0de is writing an irr exporter for blender, the code is public but was discovered before being officially announced, so it's probably not yet complete.
It's worth looking into though, in case it is usable enough for your needs-

http://code.google.com/p/tubras/wiki/irrb
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

Sorry about the long weekend, i had to pay attention to some other things in the proyect.

i've been reading about meshbuffers.... and in the documentacion says:

"Struct for holding a mesh with a single material"

This means that the models in my scene are separated into diferent meshbuffers depending on the material.... meaning that if ... say...

i have an object.... that is composed by more than one object and i join em into a single mesh, but having diferent materials for diferent parts of the object..... ill get a diferent meshbuffer for every materiali use?

Anyone knows how this works? or where can i find further documentation on the engine API?

I particularly liked this option cause i get the chance to do some AI (even if its really simple)for model recognition

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

Post by hybrid »

Yes, a meshbuffer will only contain the poly faces which have the same material. If a vertex shares several materials it has to be duplicated into several buffers. The several buffers are grouped inside of a Mesh, which defines a complete object with several materials and material types etc. However, not all faces with the same material will go into the same buffer. Especially for animated meshes, there will be several buffers with the same material, because mesh buffers are also used to subgroup polygons (e.g. for animating them separately).
Post Reply