Forum Discussion

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

sRGB render target issue

I created an sRGB render target + view and my app clearly appears too bright in the HMD. I used:
    desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
    desc.MiscFlags = ovrTextureMisc_None;
and verified that ovr_CreateTextureSwapChainDX() returns a DXGI_FORMAT_R8G8B8A8_UNORM_SRGB texture.

Checking the Tiny Room sample, I was surprised to find that it doesn't follow the guideline from:

https://developer.oculus.com/documentation/pcsdk/latest/concepts/dg-render/

and creates a non-sRGB view for the sRGB render target. I am puzzled, can somebody explain what is going on?

OculusRoomTiny: main.cpp:
    bool Init(ovrSession session, int sizeW, int sizeH)
    {
        Session = session;

        ovrTextureSwapChainDesc desc = {};
        desc.Type = ovrTexture_2D;
        desc.ArraySize = 1;
        desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
        desc.Width = sizeW;
        desc.Height = sizeH;
        desc.MipLevels = 1;
        desc.SampleCount = 1;
        desc.MiscFlags = ovrTextureMisc_DX_Typeless;
        desc.BindFlags = ovrTextureBind_DX_RenderTarget;
        desc.StaticImage = ovrFalse;

        ovrResult result = ovr_CreateTextureSwapChainDX(session, DIRECTX.Device, &desc, &TextureChain);
        if (!OVR_SUCCESS(result))
            return false;

        int textureCount = 0;
        ovr_GetTextureSwapChainLength(Session, TextureChain, &textureCount);
        for (int i = 0; i < textureCount; ++i)
        {
            ID3D11Texture2D* tex = nullptr;
            ovr_GetTextureSwapChainBufferDX(Session, TextureChain, i, IID_PPV_ARGS(&tex));
            D3D11_RENDER_TARGET_VIEW_DESC rtvd = {};
            rtvd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
            rtvd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
            ID3D11RenderTargetView* rtv;
            DIRECTX.Device->CreateRenderTargetView(tex, &rtvd, &rtv);
            TexRtv.push_back(rtv);
            tex->Release();
        }

        return true;
    }
No RepliesBe the first to reply