After a bit of experimentation, it looks like these are two separate issues.
Clipping: some of the camera frustum parameters are hard-coded rather than derived from the data, and the hard-coded values were too small for my building. I was able to get reasonable behaviour for my export by making the following changes to the generated file:
- var persCamera = new THREE.PerspectiveCamera( data.camera.focalDistance, window.innerWidth / window.innerHeight, 1, 10000 );
+ var persCamera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 100000 );
- var orthCamera = new THREE.OrthographicCamera(-aspectRatio * viewSize / 2, aspectRatio * viewSize / 2, viewSize / 2, -viewSize / 2, -10000, 10000);
+ var orthCamera = new THREE.OrthographicCamera(-aspectRatio * viewSize / 2, aspectRatio * viewSize / 2, viewSize / 2, -viewSize / 2, -10000, 100000);
I’m not sure what’s going on with data.camera.focalDistance being passed as the first argument of THREE.PerspectiveCamera; according to the three.js docs that’s “fov — Camera frustum vertical field of view”.
For the OrthographicCamera I just bumped up the value for the far plane from the hard-coded 10000 (10m?) to 100000 (100m?).
I think a proper fix should calculate the far plane from the model data, but that’s a bit beyond my current JavaScript…
View buttons: the code for these needs fixing slightly. The current code positions the camera at max-x for “Right”, max-y for “Top” and max-z for “Front”. It needs to position the camera at min-y for “Front” and max-z for “Top”. I’m fairly confident about this change so I’ll send a pull request.
I’ve put the manually-edited version of the export at https://www.assorted.org.uk/steve/stuff/Garage-v2-fixed.html. There’s still something a bit off with scaling in the perspective view but I can’t quite describe it properly at the moment.