Confusion on boundingVolumes

I have 2 triangles (TriMeshes) both attached to rootNode and both with their own computed ModelBound();



What seems to happen is that there are cases when my View is visably away from one of the TriMeshes, but it’s triangles are still being counted at the bottom. Does this mean that the culling is only an approximate thing and that something can -not- be culled and it’s boundingVolume totally out of view? Just curious.

Maybe I’m not understanding your question, but a volume is either a box or a sphere, so depending on the which volume you use and the shape of the geometry, you’re accuracy will vary. Render the bounding volumes for your triangles to how the relationship works.

I have 2 triangles surounded by BoundingBox’s. The triangles are flat against the Z axis, so a bounding box should cover them very easily. Yet, it is posible to totally not see one triangle but have it’s triangles counted. That shouldn’t happen (??) because a boundingbox should cover a triangle exactly except for that top part



*

|- (Top part)

|–

|—

----



So if my view was to the left of this triangle, which was surounded by a boundingBox, it shouldn’t be counted at all correct?

Render the boundings. How is it surrounding the triangle?

This is a basic program to demonstrate my behavior. When it starts, move the view directly down untill the top right triangle is gone from view. You’ll notice the boundingBox is totally unvisable but it’s triangle is still counted. The same happens if you move the view directly to the left. On the other hand, if you move the view diagonally down and left, it works correctly. I am unable to reproduce this behavior with the bottom left triangle.

===============

public class AGame extends SimpleGame{

TriMesh myThing1;

TriMesh myThing2;

protected void simpleRender() {

display.getRenderer().drawBounds(myThing1);

display.getRenderer().drawBounds(myThing2);

}

public static void main(String[] args) {

new AGame().start();

}

protected void simpleInitGame() {

Vector3f[] verts=new Vector3f[]{

new Vector3f(0,0,0),

new Vector3f(1,0,0),

new Vector3f(0,1,0)

};

int[] indices=new int[]{0,1,2};

myThing1=new TriMesh(“Mine1”);

myThing1.setVertices(verts);

myThing1.setIndices(indices);

myThing2=new TriMesh(“Mine2”);

myThing2.setVertices(verts);

myThing2.setIndices(indices);



myThing2.setLocalTranslation(new Vector3f(5,5,5));

myThing1.setModelBound(new BoundingBox());

myThing2.setModelBound(new BoundingBox());

myThing1.updateModelBound();

myThing2.updateModelBound();

rootNode.attachChild(myThing1);

rootNode.attachChild(myThing2);

}

}

The bounding box surounds my triangle just as described in my second post on this thread.

Renanse believes he knows what is causing the issue and is looking into it now.

Coolness. You give cookies to frequent bug catchers? Choci chip? 8)

Fixed and committed. This fix seems to speed up other demos, like terrainpage for example. Thanks for catching it. :slight_smile:

Have a chance to look at what was causing problems when mixing boundingSphere and boundingBox (see bug forum)?