javagl / JglTF

Java libraries related to glTF
MIT License
209 stars 62 forks source link

Add an option to fit the external camera to the scene #7

Open javagl opened 7 years ago

javagl commented 7 years ago

For large scenes, and particularly for scenes with a large translation in the root node (as in https://github.com/KhronosGroup/glTF/issues/781 ) it is essential to have an option to fit the camera to the whole scene.

Parts of the implementation may later be moved to https://github.com/javagl/Rendering/tree/master/rendering-core/src/main/java/de/javagl/rendering/core/view , but the computation of the bounding volumes of the (transformed) geometry has to be done in the glTF model classes.

While resolving this issue, consider adding an option to let the external camera "match" one of the cameras in the glTF, so that the viewer may start with the predefined view configurations, but still navigate through the scene.

javagl commented 7 years ago

The basic functionality to fit and reset the camera is implemented as of https://github.com/javagl/JglTF/commit/338d1697e303fea24448dd2ec0a7c3afacffb5b3 . This issue will remain open until the option of matching the external camera to a predefined camera has been evaluated.

javagl commented 7 years ago

Fitting the camera to the scene is one part. But in order to be able to fit the camera to arbitrary scenes, the view also has to be updated - particularly, the near and far clipping planes. For some scenes ( https://github.com/javagl/JglTF/issues/11#issuecomment-272591249 ) problems have been reported that are most likely related to the current (fixed!) near and far clipping planes.