wrong ortho cam frustum when filmsize is large

currently i have a geomipterrain and an ortho cam pointing down 90 degrees.
when filmsize is larger than (1.77777x8500,8500), the frustum of cam doesn’t increase anymore. why is that?
the result is that parts of the geomipterrain are culled.

another question: can i toggle view-frustum-cull in runtime?

You can always create an OmniBoundingVolume (or a sufficiently large BoundingSphere) around your geometry that you don’t wish culled. Use setFinal(True) also on the same node so that lower-level bounding volumes don’t override your artificially large volume.

David

i tried modifying boundingvolume. but each time i called node.getBounds().around() , the whole app crashed. such as: getBounds().around((0,0,0),(1,1,1)). i am using Panda 1.80 .
or is around() not the right way to modify boundingvolume?

another problem is: geomipterrain has the right boundingvolume as a whole, such as bbox (-51200 -51200 0) to (51200 51200 1500).
but each block has unscaled boundingvolume, such as, with blocksize set to 64, then the volume is (0 0 0) to (64 64 0.34567).
i got that by calling geomipterrainnode.getChild(0).getBounds() .

You can’t modify an existing bounding volume, because it’s a const object. You have to create a new bounding volume to replace it. (And when you say the app “crashes”, what you really mean is that you generated a Python exception, which terminated the app. You can see the precise exception in the output. If you were running Python interactively, it would have dropped you back to a Python prompt and you could continue running.)

Bounding volumes are relative to the parent node’s transform, as with anything else in Panda. So if your parent node has a large scale, the children will automatically inherit that scale. If you examine the bounding volume of a child node directly, it won’t include the scale (because that bounding volume will be implicitly scaled).

David

by saying ‘the whole app crashed’, i meant Python also crashed, nothing left, so i couldn’t see the exception type.
the around() function is the only one that crashes Python, that i’ve seen by now. and it happens every time.
i use interactive mode for development. i really like python because of this, easy debugging and trying out functions.

and what is the right way to make a new boundingvolume? i tried getBounds().makecopy() (i remember so) . but because of the crashing of around() function, i never succeeded in boundingvolume.

model.node().setBounds(OmniBoundingVolume())
model.node().setFinal(True)

sorry, i still can’t solve the whole problem.

setting OmniBoundingVolume to each block of geomipterrain can solve the problem of wrong culling in ortho cam.

but when i switch back to perspective cam, i want correct culling, for framerate reason.
then how should i restore the boundingbox?

i tried: node().setBounds(BoundingBox()) , that gave me an empty box.
i also tried storing the original box before applying omniBV, such as:
original=xxxxx.node().getBounds()
then restore the box by:
xxxxx.node().setBounds(original)

– where original has the volume of something like (0 0 0) to (64 64 0.34567)

but then the block of terrain doesn’t show up like before. strangely, when i call node().getBounds() again,
the volume is like (32 32 0) to (96 96 0.34567)

and because around() function crashes, i can’t modify any box.

i don’t want to regenerate the whole terrain each time i switch camera. since i expect frequent camera changes.
is there anything else that i can try?

model.node().clearBounds() will undo a previous call to setBounds(). You might also want to call setFinal(False).

David

Thank you. problem solved.