Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
cratesmith's avatar
cratesmith
Explorer
11 years ago

Camera Chains, Depth Clearing and Timewarp?

I'm working on upgrading a game from the 0.3 sdk to 0.4.1 and I've run into this problem.
Short version: I'm using multiple cameras and clearing depth, so I'm not giving the timewarp filter depth values for most pixels.


Click to enbiggen.


The game uses the following cameras (simplified a bit)
- Background
- World
- HUD

In 0.3 these would all be OVRCameraControllers and that worked fine. In 0.4.1 that's not an option so I'm currently doing the following.
- The HUD camera is the OVRCameraController
- All other cameras are active objects but disabled
- In OnPreRender each OVRCamera has a component that calls camera.Render on the world camera, which has a similar component/does the same for background
- All cameras are set to clear to depth (background will always draw all pixels)

This looks good! There's no lag, no doubling, draw orders are fine and there's no intersections.
But my understanding is that the timewarp post process makes use of the depth buffer, and in this method only the HUD camera has preserved it's depth.

My present plan is that once full screen effects work again (I can't get them to work at all on mac), I can clone off the depth of each camera and composite a depth buffer for opaque pixels as a post process on the OVRCamera. Just getting the world camera would be fine, I get the feeling I might need to rescale Z regions so that the filter has depth to work on for the background.

It seems like a lot of work to do something that should be quite simple,
is there any easier way to go about it? Also is my plan going to work? (I'm pretty rusty at this stuff)

6 Replies

Replies have been turned off for this discussion
  • LaeusVR's avatar
    LaeusVR
    Honored Guest
    With 0.4.1, I was able to have multiple OVRCameraControllers (as opposed to 0.4.0, where I had to use a modified OVRSubCamera component). I have three pairs of OVRCameras. Though, I'm on Windows, maybe that's the difference?
  • "LaeusVR" wrote:
    With 0.4.1, I was able to have multiple OVRCameraControllers (as opposed to 0.4.0, where I had to use a modified OVRSubCamera component). I have three pairs of OVRCameras. Though, I'm on Windows, maybe that's the difference?


    My understanding is that the timewarp filter will not work properly or at all for opaque pixels that have had their depth cleared. I could be wrong about this and if so I've wasted a few days, but I have come up with a solution that behaves like layered cameras with depth clearing that ensures a final depth buffer for timewarp to operate on.

    It's pretty detailed so I might write a blog post about it when I get time and after checking some facts.
  • "cratesmith" wrote:
    I'm using multiple cameras and clearing depth, so I'm not giving the timewarp filter depth values for most pixels.

    That should work fine. Timewarp doesn't use depth information.

    "cratesmith" wrote:
    But my understanding is that the timewarp post process makes use of the depth buffer, and in this method only the HUD camera has preserved it's depth.

    You may be thinking of the experimental "positional timewarp" feature we've talked about a few times. It has never been exposed by the SDK. There's no need to worry about it or send us depth values.

    "LaeusVR" wrote:
    With 0.4.1, I was able to have multiple OVRCameraControllers (as opposed to 0.4.0, where I had to use a modified OVRSubCamera component).

    I would still recommend using OVRSubCamera instead of multiple OVRCameraControllers with 0.4.1. Is OVRSubCamera giving you trouble?
  • Is that experimental positional timewarp at any stage where I could try it out with my layered depth hack? I'm curious to see how effective it is in case this ever becomes part of the main sdk.

    As for OVRSubCamera I was having some trouble initially with it rendering the wrong eye and a couple of other minor problems, but I've modified it pretty heavily to make the depth layering work as well as making it easier to use with things like the concept of OVRSubCameraControllers that have their own camera render order values.

    I can share my version of it if it would help anyone else, it just needs a bit of trimming and cleaning up now I know I don't need to do the depth preservation stuff.
  • If anyone needs it, here's my OVRSubCameraController setup
    https://www.dropbox.com/s/oo2jhzbg9mnfa0u/OVRSubCameras.zip?dl=0

    You use it by:
    1. Put the OVRRootCameraController component on your OVRCameraController object and OVRSubCamera components on each of the eyes and link them up in the inspector. (this one will always render last!)

    2. Create subcameras by creating an object with the OVRSubCameraController on them ( Set the depth value if you need to here, not on the cameras), and two children with the OVRSubCamera component on each, again link them up.

    3. press play!
  • Thanks for your help Cratesmith!

    It's a nifty little system and if you've seen my threads about camera layering you'll know I've been struggling with this for a while for Lunar Flight.

    This has got me the furthest so far, it works in the Editor however when I make a Standalone build I get a Blank screen. So close but no cigar for me :cry:

    I wish OVR would make this and standard feature of the SDK, it has been a topic of discussion for so long and considering just how many projects are 'Cockpit' based you'd think it would be a much higher priority to offer an official solution.