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.
IrrEdit - Calculating lightmaps for octree meshes
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
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.
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.
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.
- 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.