Forum Discussion
nuclear
9 years agoExplorer
libgoatvr: my modular VR abstraction library
In case anyone is interested, I just finished a first working version of the clean redesign/rewrite of GoatVR, my modular VR abstraction library: https://github.com/jtsiomb/libgoatvr. It's a bit rough yet, but it can be used to make cross-platform VR programs. Currently it comes with the following VR backends/modules:
A program written against this library should work transparently with the oculus rift on windows and GNU/Linux (supported HMDs at the time of OVR 0.5 of course), should work with any HMD supported by OpenVR/SteamVR (so both HTC vive and the oculus HMDs), and should work in simple stereo mode with 3DTVs, shutter glasses, red-cyan glasses, etc. Of course some features will not be available with all modules. For instance, with the SbS module active, goatvr_view_matrix() will only give you the stereo offset and not any kind of head-tracking.
Anyway, as I said this is an early version, but feel free to submit bug reports, feature requests, patches, etc, if you feel like using it.
- Oculus SDK 1.x (windows)
- Oculus SDK 0.5 (last GNU/Linux version)
- OpenVR/SteamVR
- Side-by-Side stereo
- OpenGL quad-buffer stereo
- Anaglyph stereo (red-cyan glasses).
A program written against this library should work transparently with the oculus rift on windows and GNU/Linux (supported HMDs at the time of OVR 0.5 of course), should work with any HMD supported by OpenVR/SteamVR (so both HTC vive and the oculus HMDs), and should work in simple stereo mode with 3DTVs, shutter glasses, red-cyan glasses, etc. Of course some features will not be available with all modules. For instance, with the SbS module active, goatvr_view_matrix() will only give you the stereo offset and not any kind of head-tracking.
Anyway, as I said this is an early version, but feel free to submit bug reports, feature requests, patches, etc, if you feel like using it.
2 Replies
- galopinHeroic ExplorerLittle advice, do not hesitate to expose values, even if it means capability flags for some hardware. If you do not know why something can be useful, some one else may crave for it. An easy example, why limiting the projection to a basic near far pair with a depth test set to less or equal. infinite far projection with a greater than depth test are not popular for nothing :)
And i am gonna give you a magical tips too, your stereo projection is really bad, tonight you will learn the best matrix setup for an incredible depth effect in a stereoscopic rendering, nothing less than that, and all it needs is a translation on the X axis before AND after the projection matrix with well craft values :)
With the code below, you get two things :
1) you have the full control of the convergence plane with S. Objects farther than S appear inside the TV, closer than S appear in front of the TV, and at S appear on the TV plane.
2) By using the physical TV width in the formula, you now are able to generate a maximum separation of the inter-ocular distance at the infinity, maximizing by doing so the depth effect without creating a dangerous divergence.
You will notice that i use a 60 degrees FOV, it is because the human effective vision focus cone is 60 degrees, and if you seat at the correct distance to your TV, you match the screen into that human natural cone. This is also the story behind PC players using 90 degrees, it is not to be fancy, it is because you seat closer to the monitor and doing so, your vision cone is only covering a portion of the surface and using 90 degrees put in fact the effective 60 degrees where they belong :)float I = 6.4f; // interoccular distance
float W = 60.f; // screen width of your 3DTV
float r = 0.5f; // depth effect strength [0..1]
float S = 100.f; // focal plane distance
float F = 60.f * 3.1415f / 180.f; // horizontal FOVfloat A = r * I/W;
float B = A * S * std::tan(F * 0.5f);
// Left eye VP = V . Tx(+B) . P . Tx(-A)
// Right eye VP = V . Tx(-B) . P . Tx(+A) - nuclearExplorerHello, thanks for the tips. The SbS module is really not fleshed out or tested very much, and I was planing to examine the stereo transformations more closely at some point. I'll make sure to keep your post, and refer to it then.
As for the inverted-depth projection matrix, you're right it's useful in some cases, and I should add some kind of option to allow for it.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 11 years ago
- 6 months ago