IrrEdit - Calculating lightmaps for octree meshes

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
CppJunky
Posts: 6
Joined: Wed Jan 16, 2008 8:08 am
Location: Germany
Contact:

IrrEdit - Calculating lightmaps for octree meshes

Post by CppJunky »

Hello!

I'm using IrrEdit for assembling my Irrlicht scenes and now I'm in some trouble with octree nodes. What's the reason I cannot calculate lightmaps for use on a mesh of an octree node? It tells me that the node's no mesh - But wheres the difference between a mesh organized in an octree and a "normal" mesh node?? :?:
Well, I would simply use the lightmaps provided by my quake3 bsp mesh, but actually, the IrrEdit lightmaps are much nicer and provide more features.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, what did they tell you over at the irrEdit forum?
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi, Cppjunky.

IRRedit cannot render OCCTREE node. The difference between the occtree and a standard mesh, is that the occtree can be used for the collision algorithm.

There a workaround:

1. Load all objects in your IRRedit scene as meshes
2. Use the light mapper to create the lighmaps
3. Save your textures, save a copy of your scene in case of problem.
4. Remove the objects meshes that you want to use as OCCtree
5. Reload the OCCtree objects
6. Re-Apply the lightmap texture you used previously calculated using the ligtmapper.
CppJunky
Posts: 6
Joined: Wed Jan 16, 2008 8:08 am
Location: Germany
Contact:

Post by CppJunky »

Ok thank you, I just thought about something like that, but I guess I'll do some hacks in my code then. I'll try to hack the irr-loader or scene-structure and try to convert my "standard" mesh-nodes to octree-nodes "on the fly". Reporting back when I'm done :wink:
CppJunky
Posts: 6
Joined: Wed Jan 16, 2008 8:08 am
Location: Germany
Contact:

Post by CppJunky »

Ok, I got it working now. IrrEdit simply doesn't seem to be capable of calculating/applying lightmaps to octree meshes, but the engine of course is. So I made a rather simple but effective hack:

- Before loading the .irr file I copy it to a temporary file, then parsing the copy (".irr" is actually nothing more than xml)

- Every "mesh"-type node is beeing converted to an "octree" node. This is simply done by rewriting type="mesh" to type="ocTree" and adding the attribute "MinimalPolysPerNode" to the nodes attribute-block.

After this is done, the modified file of course can be loaded using the normal ISceneManager::loadScene function. Now the only thing to do is to create and bind octreeTriangleSelectors for each node, in order to do things like collision detection and whatever. Since this way every mesh-node is converted to an octree-node, you should use some kind of scripting or node-flags, to define which node to convert and which not.
Post Reply