Page 1 of 1

Excluding objects from the trimesh but not from the octree

Posted: Sat Jan 22, 2005 4:10 pm
by tenkei
Hi there,

We're using the DotSceneOctree scenemanager to display the static geometry on our game map. We then generate a trimesh from it using Tokamak (OgreTok) for collisions.

However, in our gamemap there are objects such as tree foilage that don't need to be collidable: we need to be able to go through the foilage, but not through the tree's trunk.

I've tested a solution where I tagged such objects in 3dsmax before exporting them and excluded them from the octree, loading them as separate entities later on. This had a rather severe performance impact on the game, but otherwise worked as expected.

So, I'd like to keep those objects in the octree for performance reasons, but I also want to exclude them from the trimesh.

Has anyone done anything like this before? If so, how did you pull it off?

Posted: Sat Jan 22, 2005 11:22 pm
by Mdobele
For our game "ScootaRama" we did a simmiliar technique as to what you want.

We also flaged all of our meshes with a particular naming convention in 3DSmax. Then when we were parsing and loading our .scene file we were able to build physics / particles / animations based on the nameing convention of the mesh eg. TRI_TrackTown01.mesh would indicate that that piece of mesh was to be built as a trimesh. For an object like a tree we found it was easiest simply in max to surrond the tree with an extremely simple cylinder that was used to build the collision instead of the higher poly version of the tree trunk itself. The low poly version was still a trimesh as back then we were having alot of problems getting an orientation out of the .scene file. You then just make the collidable cylinder invisible and it all looks good and should work as you want and its still using the octree as normal.

Posted: Sun Jan 23, 2005 4:38 pm
by tenkei
Thanks for the reply. However, this isn't exactly what I meant.

The loading of the map is in this order in our game:

1) We load the octree from the .scene/.bin, using DotSceneManager::addGeometry()
2) We generate the trimesh from the octree as explained here.
3) We parse the .scene file to load other non-static objects (items, physical objects etc...)

We could load the tree foliage at 3) by tagging it so that it's excluded from the octree compilation, thus removing it also from the trimesh; however that causes a severe performance hit..

My goal's to remove it from the trimesh only, therefore somehow adjusting step 2) for it... however, I've no idea how to mess with the vertex data or pointer data in the octree to do ths.

Posted: Mon Jan 24, 2005 12:14 am
by Mdobele
I'd still simply do it when you are creating the trimeshes to begin with. Still using a naming convention. That has to be easier and less time consuming o not buil dit in the first place then having to build it and then remove pieces again.

1) We load the octree from the .scene/.bin, using DotSceneManager::addGeometry()

2) We generate the trimesh from the octree as explained here.
-- Only create trimeshes for pieces named TRI_whatever. That can be done with one simple IF statement around the function you linked before.

3) We parse the .scene file to load other non-static objects (items, physical objects etc...)

I'd still in your modelling program create a very low poly cylinder and put it around the tree trunks and build the trimesh based from that instead of the actuall tree trunk mesh itself which is probably higher poly. Name that cylinder TRX_whatever, and then you simply build the collision for it at the same step but dont render it so all you see is your mesh tree, which is still all part of the octree and collide with an invisible cylinder.