View frustum offsetting

Hi everyone (ok, mostly Dan),

threejs has a camera method called setViewOffset ( that can be used to offset the view frustum for doing fancy things like rendering a scene across multiple windows and multiple machines. It’s also useful for rendering a 3D scene using an Oculus Rift.

As far as I can tell, the Cesium equivalent is to use a PerspectiveOffCenterFrustum instead of a regular PerspectiveFrustum. Is that correct? Chris Cooper and I were trying to do that last night, and not having much luck. The problem is that several places in Cesium pretty much assume a PerspectiveFrustum. One is GlobeSurface, which uses the fovy property for LOD selection (my fault). Another is picking. But even after I hacked around those problems, something else was broken. Even just cloning the PerpsectiveOffCenterFrustum created internally by PerspectiveFrustum and assigning it to camera.frustum would cause the scene to break in interesting ways.

Chris was able to get things working by changing PerspectiveFrustum itself, like this:

But I’m guessing that’s not the approach we want.

Any advice for us?



Hi Kevin,

I started fixing anything that was assuming the frustum was a PerspectiveFrustum in the offCenterProjection branch. The SceneTransitioner is still broken, but I think everything else is OK now. The main problem was changing the near/far plane distances for multi-frustum rendering. What we want to do there is keep the top, bottom, right and left planes the same while changing the near and far which wasn’t being done for PerspectiveOffCenterFrustums. Checkout updateNearFar method of PerspectiveOffCenterFrustum. You’ll need to change it to adjust the top, bottom, right, left distances when the near distance changes. Right now it assumes that the frustum is centered.

Let me know how it goes. If you don’t have any problems, I’ll get it in shape for master.



Awesome, thanks Dan! I tried it out and it seems to be working nicely. Chris will probably want to give it a full run-through when he gets back into the office on Monday (our Sunday night).