Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
cMusterle_Ensca's avatar
cMusterle_Ensca
Honored Guest
8 years ago

ovrLayerEyeFovDepth in 1.20 SDK for positional timewarp

Hi everyone,

we've just upgraded our Oculus implementation in Enscape for the latest windows SDK release v1.20 which should feature depth buffer support for positional timewarp according to the release notes.

We therefore create an additional depth texture swap chain:
    ovrTextureSwapChainDesc depthDesc = {};
        depthDesc.Type = ovrTexture_2D;
        depthDesc.ArraySize = 1;
        depthDesc.Width = size.w;
        depthDesc.Height = size.h;
        depthDesc.MipLevels = 1;
        depthDesc.Format = OVR_FORMAT_D24_UNORM_S8_UINT;
        depthDesc.SampleCount = 1;
        depthDesc.StaticImage = ovrFalse;


        if(!OVR_SUCCESS(ovr_CreateTextureSwapChainGL(Session, &depthDesc, &DepthTextureChain)))
        {

And render to it:
    GLuint curDepthTexId = 0;
        if (DepthTextureChain)
        {
            int curIndex;
            ovr_GetTextureSwapChainCurrentIndex(Session, DepthTextureChain, &curIndex);
            ovr_GetTextureSwapChainBufferGL(Session, DepthTextureChain, curIndex, &curDepthTexId);
        }

        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboId);
        glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, curColorTexId, 0);
        glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, curDepthTexId, 0);

We set up the layer description for ovrLayerType_eyeFovDepth:
m_layerDescription.Header.Type  = ovrLayerType_EyeFovDepth;
m_layerDescription.Header.Flags = ovrLayerFlag_TextureOriginAtBottomLeft;

    for (size_t eye = 0; eye < m_eyeSwapBuffers.size(); ++eye)
    {
        m_layerDescription.ColorTexture[eye] = m_eyeSwapBuffers[eye]->ColorTextureChain;
        m_layerDescription.DepthTexture[eye] = m_eyeSwapBuffers[eye]->DepthTextureChain;
        m_layerDescription.Viewport[eye]     = OVR::Recti(m_eyeSwapBuffers[eye]->GetSize());
        m_layerDescription.Fov[eye]          = m_hmdDesc.DefaultEyeFov[eye];
        m_layerDescription.RenderPose[eye]   = m_eyeRenderPose[eye];
        m_layerDescription.SensorSampleTime  = m_sensorSampleTime;
    }
m_layerDescription.ProjectionDesc = ovrTimewarpProjectionDesc_FromProjection(proj, ovrProjection_ClipRangeOpenGL);

And can successfully submit that frame:
ovrLayerHeader* layers = &m_layerDescription.Header;
ovrResult result = ovr_EndFrame(m_hmdSession, m_frameIndex, nullptr, &layers, 1);
However there's absolutely no difference noticeable compared to not using the depth buffer at all, or when I messed around with the projection description to provoke reprojection artifacts. Upgrading the Oculus App to the latest Beta also didn't have any effect on that matter.

Is there anything else we're missing to enable positional timewarp (in a GL application)? Sample implementations of the SDK are unfortunately a little sparse in that regard.

Thanks a lot in advance for any advice on that matter!
-Clemens

3 Replies

  • Slin's avatar
    Slin
    Expert Protege
    I don't think the time warp is using that information yet (but is meant to be in the future) and it is purely used to render things in front of Dash elements.
  • Hi Slin,
    thanks for clearing that up! That's a bummer, the release notes read like it was finally there. I haven't followed these developments that closely lately - is this a planned feature for the 2.0 runtime?
  • I was testing the DepthBuffer for overlay with QuadLayers and had very strange results. Also the documentation says there will be no depth test with the Layers, but that does not make sense also since I definitely got depth intersection but with strange depth-offset. I wish they would at least hire one guy to keep track of the documentation and not only provide the next even better homescreen with more avatars and things nobody needs.