openvr icon indicating copy to clipboard operation
openvr copied to clipboard

What is the FOV for image accessed through IVirtualDisplay ?

Open thefallentree opened this issue 4 years ago • 8 comments

I am working on something that is similar to what SteamVR‘s VR view does. Inspecting vr images. I managed to combine an Virtual display device with a null HMD device and I am able to get both eyes image with controlled pose.

My question is ,

  1. What is the fov in the image returned through Present() ?
  2. And is this fixed? Could I get the openvr to send me 180 image or even 360image in single frame? Of course I can update pose and get an different view, but is it possible to just get an full view instead?
  3. Openvr gives me both eyes image, is it possible to get access to the image before the eye split?

thefallentree avatar Dec 29 '21 13:12 thefallentree

  1. What ever the driver controlling the HMD device set's it to.
  2. No its not fixed (but again, depends on the HMD vendor), but also no you can't control it.
  3. There is no split, both eyes are rendered separately, if you want to merge them you'll have to do that on your own.

But in any case to "inspect VR images" your best bet would be to make a tracked device with an IVRCameraComponent component.

Jerry rigging an HMD device for this is not the best way to do this to say the least.

okawo80085 avatar Dec 29 '21 13:12 okawo80085

@okawo80085 thanks, but I think you misunderstood me, I am indeed writing my own openvr HMD driver and using an null HMD driver that basically is same as driver_sample in the ask.

Do you have example how to control FOV in my hmd driver? Is that a property or something?

thefallentree avatar Dec 29 '21 17:12 thefallentree

But in any case to "inspect VR images" your best bet would be to make a tracked device with an IVRCameraComponent component.

The document are not exist for this component, what does it do? Judging from naming it seems to be to control an physical camera on a device, but what I really need is to control in-game virtual cameras

thefallentree avatar Dec 29 '21 18:12 thefallentree

I am indeed writing my own openvr HMD driver and using an null HMD driver that basically is same as driver_sample in the ask.

Ok great, all the more reasons to make a camera device instead of an HMD. Making an proper HMD is really hard + you're taking the ability of using a different HMD away from the user.

Do you have example how to control FOV in my hmd driver? Is that a property or something?

Yes there is an example, no it's not a property, but it's also not controlled by IVRVirtualDisplay. The simplest(also the only official) example comes from the sample driver IVRDisplayComponent implementation, look at the GetProjectionRaw() method. IVRDriverDirectModeComponent has something similar in it's per eye layer descriptors, but its stored as a 4x4 matrix.

The document are not exist for this component, what does it do? Judging from naming it seems to be to control an physical camera on a device, but what I really need is to control in-game virtual cameras

Yes there is no documentation, welcome to the OpenVR driver development world. And you got it completely backwards my guy, this component can be used with any tracked device and it serves the role of a virtual camera, i.e. exactly what you need, something similar to LIV virtual cameras.

okawo80085 avatar Dec 30 '21 15:12 okawo80085

this component can be used with any tracked device and it serves the role of a virtual camera, i.e. exactly what you need, something similar to LIV virtual cameras.'

Chers, yeah lacking documentation or especially some overview explain how piece fit together is the most painful part.

I looked into LIV virtual camera, and I think those are for capture real-world images into game to be displayed in a HMD. which is actual the opposite of what I want. you still misunderstood me, so allow me to try to explain my intention once more.

What I set to do , is to display multiple in-game view onto different window on my monitor simultaneously, it is a bit like having more than two eyes (and potentially further apart). so I need to somehow control the in-game camera to show me multiple view so I can render them into different windows. So far I have managed to send pose to my HMD driver and get a single point of view image through my virtual display driver, but I'm not sure how to get multiple view (or even it is possible).

thefallentree avatar Dec 30 '21 21:12 thefallentree

I did not miss understand what you meant, and i am saying that you're taking the wrong approach to this issue.

This is how you can use LIV to for what you want, jerry rigging an HMD device is plain stupid when what you want can be achieved using virtual cameras (tracked devices with IVRCameraComponent implemented), specially when there are ready made free solutions like LIV.

All my previous points still stand.

okawo80085 avatar Dec 31 '21 00:12 okawo80085

I looked into How Liv does this, I get the part where it adds a tracked device with IVRCamearComponent , and it uses a separate compositor to draw over steamvr that display the view from a separate camera in game. But, in my testing, it appears that the most important part of what I want to do: "capture in-game view" in LIV actually requires the game to add support by using their unity/unreal plugin , which will add a in-game Rig/Camera that will be controlled by Liv capture software, which then stream the in-game view to the capture software / compositor. I think this is why the liv software simply display avatar with am empty box in non-supported game (for example steamVR home).

I'm still confused with what IVRCameraComponent does, I have added a track device with IVRCameraComponent but so far I've only managed to get Activate() called, no idea how to trigger opevr to call all the other functions. (or how to even start the videostream)

thefallentree avatar Dec 31 '21 12:12 thefallentree

As far as I understand it, IVRCameraComponent is just for adding an actual physical camera, so you can use the camera video feed in the room view or from IVRTrackedCamera. If I'm understanding the OP correctly, they are making a fake HMD driver, which wouldn't need this, and just adding a generic tracked device would require explicit support from every application is was used in.

What FOV you get depends on the projection matrix you pass in for each eye. I don't have any experience with writing custom drivers , but it seems to be determined by what you return from your drivers version of IVRDisplayComponent::GetProjectionRaw(), which should take the clipping plane coordinates of the projection matrix, similar to how the OpenGL glFrustum() function works.

Rectus avatar Jan 06 '22 15:01 Rectus