In Forge Viewer, the near and far calculation is done in an internal updateCameraMatrices
method. In that method, there's a final heuristic to fine-tune the near value better near line 31320:
// One more attempt to improve the near plane: make it 1/100,000 of the distance of the
// far plane, if that's higher.
// See https://wiki.autodesk.com/display/LMVCORE/Z-Buffer+Fighting for reasoning.
// 1e-4 is generally good below, but inside Silver Cross we get a lot of near clipping. So, 1e-5.
dMin = Math.max(dMin, dMax * 1e-5);
In some BIM models I load in the viewer I can see Z-fighting for some viewing angles. If I change the value from 1e-5 (1/100,000) to 1e-4 (1/10,000) as noted in the comments, the z-fighting is gone. This also seems like a much more appropriate value for large models (like buildings). It's maybe less suited for small-scale models like 3D CAD models.
Can I safely change this value to 1e-4 if all I intend to render is models in the scale of buildings (from Revit, Navisworks etc)?
Will the Forge Viewer allow to configure the near/far calculation in its API?