3

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.

  • Thank you for letting us know Björn. Let me ask the viewer engineering team, and we'll get back to you. – Petr Broz Jan 27 '21 at 08:47

1 Answers1

0

The engineering team has confirmed that there are pathological cases where due to the bounding box of the model being extremely large, the computation of the near/far camera planes causes clipping artifacts. While this is being addressed, the suggested workaround is to set the near plane to 1:

viewer.impl.setNearRadius(1);
Petr Broz
  • 8,891
  • 2
  • 15
  • 24
  • 1
    This unfortunately does not fix the issue. It will end up with near = 1 and far = 10000. Far = 10000 is still clipping elements. If I set viewer.impl.setNearRadius(50), it works better, but we now we occasionally have near clipping issues. – Björn Wahle Feb 03 '21 at 08:13
  • Any update on this, I also can see this issue with V7.62 – Afshin Mar 07 '22 at 22:09
  • ```viewer.impl.setNearRadius(50)``` works but ```viewer.impl.setNearRadius(1)``` not work for me too – MichaelMao Nov 23 '22 at 02:54