We recently updated one of our projects to use the latest version of the Autodesk Forge Viewer (v7.x).
In general, the migration went fine, however we noticed that for some models we have issues with the far cutting planes of the camera. I have figured out that this happens because the model contains some elements that are very far from the rest of the model and thus the bounding box of the entire model is magnitudes larger than it should be. This results in camera near = 1
and far = 10000
. It seems that far should be higher in order to not hide parts of the model when zooming out.
For now, we have been able to workaround the issue be specifying a the "nearRadius" when loading the model, but since we have to set it to a value like 50 or 100 in order to not have far plane issues, we still have some near plane clipping issues.
I was wondering if there is any possibility to fix the model once it is loaded, so that the viewer uses a more realistic bounding box for the model. I have found out so far that during the load it already sets the variable verylargebbox
to true and therefore is not using the nearRadius = 0
but either the passed value in the load options or 1. I was able to set nearRadius to a negative value to have the same behaviour as with nearRadius = 0
, but due to the large bounding box of the model, we still experience clipping issues.
In order to fix the model I have already tried:
- Excluding the ids of the elements that are far away with
ids = [...]
in the load options - Setting the visibility of these elements to off using
setNodeOff()
- Use
NOP_VIEWER.navigation.fitBounds()
to set the bounding box (as suggested in near and far calculation in Autodesk Forge Viewer)
However, getVisibleBounds()
still returns the huge bounding box.
We would like to find a solution in which we don't need to modify the source model file before translating it to .svf.