Please check my problem with culling. Two nodes with a common parent are used. One of the node is detached from most of its children when needed, and the other node has many children. Both with dynamic culling. If the node with very few children is the first in its parent child arraylist in certain cases the whole scenario under the other node with many children is culled too! What the heck? If I change the order in the parent arraylist of the two nodes the culling problem goes away, so if the child with many nodes is the first, culling is good, if the one with few or no children is the first, culling is wrong. I have to use a workaround:
"I've found a culling problem when externalRootNode's children are in very low number (when player is inside the cave), the whole internal scene was culled for no apparent reason. May be a JME bug, or what the heck! Anyway the solution is that when moving to internal parts from outside or back the order of internal root node and external root node are exchanged in its parent's child list (parent is the so called groundRootNode), and thus the problem goes away…maybe this is indicating a JMonkeyEngine bug or something I don't know about culling and node order?"
c = world.getCube(newCoords[0], newCoords[1], newCoords[2]);
if (c.internalLight)
{
System.out.println("Moved: INTERNAL");
insideArea = true;
groundParentNode.detachAllChildren(); // workaround for culling
groundParentNode.attachChild(intRootNode);
groundParentNode.attachChild(extRootNode);
} else
{
System.out.println("Moved: EXTERNAL");
insideArea = false;
groundParentNode.detachAllChildren(); // workaround for culling
groundParentNode.attachChild(extRootNode);
groundParentNode.attachChild(intRootNode);
}
You can see the magic which solved the problem with culling. Detach and reorder. If both of the nodes have more children the culling problem is not present.
http://jcrpg.blogspot.com/2007/08/optimization-for-caves.html