sencercoltu / openvr-customhmd

Generic OpenVR Driver, STM32 based HeadTracker and wireless motion controller firmware.
55 stars 15 forks source link

Direct Mode using a vive hmd #6

Closed Aashikr closed 7 years ago

Aashikr commented 7 years ago

Hi, I am trying to make changes to your driver to use the vive HMD for display and my imu for tracking. I have made a few changes to your code https://github.com/Aashikr/openvr-customhmd/commit/1884b54e031596bf62bc6afefcda344fb6f06aff and set direct mode to true in vrsettings. The steamvr compositor fails with the logs - Failed to create render textures (compositor)!. Do you know what the issue could be?

sencercoltu commented 7 years ago

Hi, No need to change the default const values from code, all values can be changed from the settings file(s).

Just set displayMode to "direct", enter your Vive EDID values, and it should work. (If you are planning to use the IVRDirectModeComponent) If you plan to use steam's direct mode, then set displayMode to "steam", enter the correct edid values in the settings file, set SteamVR to direct mode. I added the setting "alwaysConnected", now the IsConnected funtion returns always true if "alwaysConnected" is set to true.

Here are my settings file contents:

{SteamLibPath}\SteamVR\drivers\customhmd\resources\settings\default.vrsettings { "driver_customhmd": { "enable": false, "displayMode": "steam", "displayMode_1": "virtual", "displayMode_2": "direct", "IPD" : 0.065, "camera": "Webcam C170", "camera_2": "USB HD Camera", "monitor": "SNYD602", "supersample": 1.0, "edid_vid": 55629, "edid_pid": 54786, "virtualDisplay": "192.168.0.1", "virtualResolution": "1280x720@30", "directResolution": "960x540@30", "alwaysConnected": false } }

Steam\config\steamvr.vrsettings: }, "driver_customhmd" : { "alwaysConnected": true, "camera" : "", "displayMode" : "steam", "enable" : true, "monitor" : "", "virtualDisplay" : "192.168.0.27", "virtualResolution" : "1920x1080@30", "xwindowH" : 768, "xwindowW" : 1027, "xwindowX" : 100, "xwindowY" : 100, "xdisplayMode" : "virtual" }, "driver_null" : { "xenable" : true },

(Note that some settings are ignored in certain display modes.)

On Wed, May 24, 2017 at 4:30 AM, Aashik Gowda notifications@github.com wrote:

Hi, I am trying to make changes to your driver to use the vive HMD for display and my imu for tracking. I have made a few changes to your code Aashikr/openvr-customhmd@1884b54 https://github.com/Aashikr/openvr-customhmd/commit/1884b54e031596bf62bc6afefcda344fb6f06aff and set direct mode to true in vrsettings. The steamvr compositor fails with the logs - Failed to create render textures (compositor)!. Do you know what the issue could be?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sencercoltu/openvr-customhmd/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/ADmbrCVo1JPRD8qVbqtJZFSfSQ7GyR5yks5r84gmgaJpZM4NkfTx .

Aashikr commented 7 years ago

I am trying to use Steam's direct mode. VR compositor crashes with the following errors - Wed May 24 2017 14:09:23.773 - Headset is using direct mode Wed May 24 2017 14:09:23.787 - Initializing CD3D11VRRenderer Wed May 24 2017 14:09:23.796 - Creating nvapi display Wed May 24 2017 14:09:25.143 - Failed to create render targets for NvAPI display in direct mode! Wed May 24 2017 14:09:25.147 - Failed to initialize compositor Wed May 24 2017 14:09:25.147 - Failed to start compositor: VRInitError_Compositor_Failed

I see the Vive's headset led color change from red to green and back to red. I've followed your steps and set steamVR to direct mode. Is this an issue because of different display values set in VRServer ?

VR server logs - Active HMD set to customhmd.HMD-1244244 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::GetWindowBounds x: 0, y: 0, w: 480, h: 270 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::IsDisplayOnDesktop returning 1 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::IsDisplayRealDisplay returning 0 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::GetRecommendedRenderTargetSize w: 240, h: 270 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::GetProjectionRaw Eye: 0, l: -1.000000, r: 1.000000, t: -1.777778, b: 1.777778 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::GetEyeOutputViewport Eye: 0, x: 0, y: 0, w: 240, h: 270 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::GetProjectionRaw Eye: 1, l: -1.000000, r: 1.000000, t: -1.777778, b: 1.777778 Wed May 24 2017 14:09:23.700 - customhmd: CTrackedHMD::GetEyeOutputViewport Eye: 1, x: 240, y: 0, w: 240, h: 270

default.settings - { "driver_customhmd": { "enable": true, "displayMode": "steam", "displayMode_1": "virtual", "displayMode_2": "direct", "IPD" : 0.065, "camera": "Webcam C170", "camera_2": "USB HD Camera", "monitor": "", "supersample": 1.0, "edid_vid": 53794, "edid_pid": 43521, "virtualDisplay": "192.168.0.1", "virtualResolution": "2160x1200@30", "directResolution": "2160x1200@30", "alwaysConnected": true } }

steamvr.settings - { "driver_customhmd" : { "alwaysConnected" : true, "camera" : "", "displayMode" : "steam", "enable" : true, "monitor" : "", "virtualDisplay" : "192.168.0.27", "virtualResolution" : "1920x1080@30", "xdisplayMode" : "virtual", "xwindowH" : 768, "xwindowW" : 1027, "xwindowX" : 100, "xwindowY" : 100 } }

Aashikr commented 7 years ago

Update - setting directMode = "true" in steamvr.settings -steamvr fixed this issue. Thank you @sencercoltu

sencercoltu commented 7 years ago

there was a typo in the code, TrackedHMD.cpp line 251: if (m_DisplayMode = DisplayMode::SteamExtended) which is fixed now.

Aashikr commented 7 years ago

what about isConnected() in TrackedHmd.cpp? shouldn't it return true when displayMode::steamDirect?

sencercoltu commented 7 years ago

Normally IsConnected() only returns true if the GPU is AMD, and the monitor whose EDID values are given is connected and is in direct mode. I didn't add support for checking the monitor presence for NV cards, because I don't own one. (I'll try to add support when I buy one.) For now, you can set the "alwaysConnected" setting to true, which will force the function to return true regardless of the mode and monitor presence.

On Thu, May 25, 2017 at 1:43 AM, Aashik Gowda notifications@github.com wrote:

what about isConnected() in TrackedHmd.cpp? shouldn't it return true when displayMode::steamDirect?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sencercoltu/openvr-customhmd/issues/6#issuecomment-303872544, or mute the thread https://github.com/notifications/unsubscribe-auth/ADmbrPHbVOz6U0PJmcZBzslUKqbpcL_3ks5r9LJ1gaJpZM4NkfTx .

Aashikr commented 7 years ago

Fixed the steam direct mode eye window size by https://github.com/Aashikr/openvr-customhmd/commit/71a9f21fdef2ead1c928ffff64ccf211bbe36dc9 . Looks like I still need to figure out the lens distortion and set it the way you do it using DistortionMap.bmp