View frustum offsetting

397 views
Skip to first unread message

Kevin Ring

unread,
May 9, 2014, 11:26:26 AM5/9/14
to cesiu...@googlegroups.com
Hi everyone (ok, mostly Dan),

threejs has a camera method called setViewOffset (http://threejs.org/docs/#Reference/Cameras/PerspectiveCamera) 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?

Thanks,
Kevin

Daniel Bagnell

unread,
May 9, 2014, 3:45:45 PM5/9/14
to cesiu...@googlegroups.com
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.

Thanks,
Dan

Kevin Ring

unread,
May 9, 2014, 4:52:33 PM5/9/14
to cesiu...@googlegroups.com
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).

Kevin


--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages