Best practice: Splitting large geometry

Hello,
I have a “best practice” question, one of those that are hard to answer because every project is different. But I will try anyway.

I have a large, static, one-chunk terrain, and I want to split it into smaller pieces for (I) culling and (II) collision detection. Especially collision detection will be slow with meshes of several thousand vertices. The EGG file until now looks like this:

<Group> {
    <Collide>
    <VertexPool> {
        <Vertex>
        ...
    }
    <Polygon>
    <Polygon>
    ...
}

Now I have several option on how to split. First, I could split the EGG file into several EGG files, one for each chunk. Or I could keep everything in one EGG file, and create additional sub-groups with a part of the geometry in each sub-group, like this:

<VertexPool> {
    <Vertex>
    ..
}
<Group> {
    <Collide>
    <Polygon>
    <Polygon>
    ...
}
<Group> {
    <Collide>
    <Polygon>
    <Polygon>
    ...
}

My questions are:

  • Is it faster (culling, collision detection) to have several EGG files, or is one EGG file with internal structure as fast as several EGG files?
  • If using one EGG file, is it better to have one global vertex pool, or one vertex pool per group?
  • If having some dozen chunks, it will probably help to organize them in a tree-like structure. Would it help too to have nested groups inside an EGG file?

Any input is welcome
enn0x

as far as i know (and i didnt write the whole stuff^^) culling is performed at geom-level. means to me: decide wheter or not a geom has to be send to your graficcard or not (collision detection … well dunno about this one but usualy it’s fast enough)
using several egg files would be the “saver” way to create culling friendly meshes.
if you want to make then into one file you should look at the manual http://panda3d.org/manual/index.php/Geom
using one vertexPool seems not possible in my eyes.

so… just use several egg’s. i’m doing the same =) additional benefit: you can load an unload them depending on your camera position. in my case i also added zones which allows me to re-center my world so i can have a theoretically unlimited terrain.
if you use different egg files you can also change a part of you terrain without exporting the entire thing again

Aside from the management conveniences of having your model broken up into different egg files, there’s no technical reason to use one egg file or multiple egg files. The end result is the same. The same goes for using multiple egg vertex pools or one vertex pool: it all ends up the same once the egg file is loaded.

Note that there is no particular correlation between a construct in an egg file, and a GeomVertexData. A is an abstract concept used in an egg file to collect and number vertices; while a GeomVertexData is a low-level construct created once an egg file is loaded, and corresponds closely to a concept of a “vertex buffer”. A GeomVertexData is (more or less) sent directly to the graphics card in a single batch. For culling purposes, each cullable unit should usually have its own GeomVertexData, but the means nothing.

The smallest cullable unit is a Geom, which is stored within a GeomNode. Panda will create (roughly) one GeomNode for each entry in your egg file that contains polygons. Each GeomNode gets its own GeomVertexData, regardless of whether you have multiple vertex pools throughout the egg file or just one. So each different entry will be a separately cullable unit.

Note that this doesn’t apply to animated egg files. In these kinds of egg files, Panda will attempt to create just one GeomNode, and one GeomVertexData, for the entire file.

David