Page 1 of 1

VR/binocular/SBS view for Google Cardboard/Oculus Rift/etc

Posted: Thu Apr 23, 2015 15:58
by dgm5555
Now that a binocular VR viewer is available for under £2 (+ a smart phone) in the form of the google Cardboard, and has already been proven on minecraft to work well, I'm keen to see it in minetest. Unfortunately due to severe lag even with client/server on the same machine on a my attempt at a lua mod with two GUIs side-by-side failed, so I think it could only be done by the engine (like 1st and 3rd person views).

I've never programmed c, but presumably it would be a simple matter of having 2 cameras displayed side by side in the same gui - the same as virtually any 3D design program, and camera.cpp seems to have code for setting this up so presumably this would be the place to start..
eg // Reposition the camera for third person view
if (m_camera_mode > CAMERA_MODE_FIRST)

Can anyone give me any pointers, as looking at the code I don't understand how to have two cameras displayed in the same gui (actually to be fair I don't really understand any of the code, but as no one else seems to be working on this I'm willing to mess about with it)?

Alternatively if someone is working on it already, or has the skills to quickly hack something together, I'm happy to test it and get the other tool chain working...

The other question is how to get the eye/camera position into minetest from the Cardboard. I presume it would be best for the server to open a port which could stream the gui and listen for the Cardboard feedback. Then the phone would run a simple android app which would display the video stream and in return pass the headset translation/pitch/yaw/tilt back to minetest.

I guess it would also be worth also considering streaming the minetest audio, and would be especially cool if a Head-related transfer function (HRTF or so called 3D-sound) could be applied which provides the ability to locate sound in 3 dimensions. OpenAL http://kcat.strangesoft.net/openal.html or similar might provide a cross-platform API to achieve this. (actually this works very well with my PC speakers, and certainly doesn't need headphones to significantly improve audio experience.

Re: VR/binocular/SBS view for Google Cardboard/Oculus Rift/e

Posted: Sat Apr 25, 2015 17:40
by kahrl
"3d_mode = sidebyside" may be the option you seek (and perhaps playing around with 3d_parallax_strength). You will need to modify draw_sidebyside_3d_mode() in drawscene.cpp if you want more complex custom camera positioning.

I just noticed that this mode causes some HUD/formspec issues, though. Not sure why or since which commit.

Edit: about the audio, minetest has always been using OpenAL for sound, so it's possible that this part already works out of the box.

Re: VR/binocular/SBS view for Google Cardboard/Oculus Rift/e

Posted: Mon Apr 27, 2015 22:08
by dgm5555
Brilliant that's cool.
vino (VNC server) seems to provide the best frame-rate for a quick test on ubuntu as the streaming clients don't work well at all.
I wonder if there would be some compression optimisation possible for a dedicated stream from minetest to an android client as the sbs views contain some similar data, or even just simple scaling I guess it would be client dependent as to where the bottle-necks lay.

I'm not sure how to get HRTF working, as minetest seems to play 'standard' stereo sound and it certainly doesn't seem localised
EDIT: actually after a bit more testing, I might be wrong on this, it seems some of the sounds (eg walking on sand/wood) are very poorly localised, whereas walking on grass is much better localised, so might actually be related to the quality of the sounds rather than the engine...

Re: VR/binocular/SBS view for Google Cardboard/Oculus Rift/e

Posted: Mon Feb 06, 2017 02:13
by EvGler
I would like to ask, if you could suggest the best type of VR Headset for gaming. What would it be?
http://www.thegoodgears.com/VR-Headset/
Are these work? I'm planning to get one this month.

Re: VR/binocular/SBS view for Google Cardboard/Oculus Rift/e

Posted: Mon Feb 06, 2017 14:08
by Jordach
EvGler wrote:Hi there!

I would like to ask, if you could suggest the best type of VR Headset for gaming. What would it be?
I'm planning to get one this month.

Thanks!
https://www.vive.com/uk/ or http://www.osvr.org/hdk2/

Oculus has a FB backdoor, not to mention their own form of DRM.