Author Topic: Preliminary VR support. Help Needed with Barrel distortion  (Read 239 times)

0 Members and 1 Guest are viewing this topic.

Preliminary VR support. Help Needed with Barrel distortion
Hi, I investigated adding PSVR support to the FS2Open engine a while ago. I was able to create a variable which would split the screen down the middle and render a left eye and a right eye view. I was wondering if anyone could help with the view offset and barrel distortion code? VR headsets use a curved lens to magnify the image. VR games must correct for the curvature of the lens. I have found websites which discuss how to implement this in OpenGL, but my mathematics skills (calculus) are garbage. My programming skills are a bit better but I don't know which method would be optimal for implementing this. From my discussions with other VR headset owners. It sounds like we should try to add the barrel distortion effect, and editable variables to manipulate it (for people with eyesight problems to self correct) separately to any head tracking or headset initialisation code. This is so the barrel distortion can be reused for other headset brands. In terms of the PSVR it only takes about 20 lines of code to get it into VR mode and showing an image on the headset. Motion tracking is provided by 6 int variables: Yaw/Pitch/Roll and X/Y/Z.
wrong answer you see hiding in that asteroid belt are 6 dralthi fighters, a Kilrathi gangbang. -Devereaux

 

Online ksotar

  • 22
Re: Preliminary VR support. Help Needed with Barrel distortion
You could start with this cool project: https://github.com/BlueSkyDefender/Depth3D/
Its author was so nice, that he has included some fix specially for Diaspora mod (and hence, Freespace 2 itself).


It is shader set for emulating SBS stereo render with quite nice quality and HMD support. It uses Reshade as a platform, and so its shader-script-like language. But math is all the same I think.

This one shader is of your interest:
https://github.com/BlueSkyDefender/Depth3D/blob/master/Shaders/Polynomial_Barrel_Distortion.fx

And here is its support thread:
https://reshade.me/forum/shader-presentation/2128-3d-depth-map-based-stereoscopic-shader

Be warned that I have posted already there, so everyone is aware of Freespace and our struggle to get VR :)

I myself want to go the other way around - to use a phone with VR headset and translation from Win PC. This is far simpler and affordable than Occulus or PSVR. I have some decent results with it already. I plan to start a thread about it, and we can join efforts at some point, what'd you think?
« Last Edit: November 16, 2017, 07:49:54 am by ksotar »

 
Re: Preliminary VR support. Help Needed with Barrel distortion
I'm investigating OpenHMD integration as it properly controls the headset and is an open source API targetting most of the common VR headsets. It's also available on Linux which is where I will be using it. I've tried their test application with the PSVR and it was quite impressive at tracking my head without using the Playstation Camera (The PSVR itself has gyroscopes and only uses the camera for positional tracking afaik).
wrong answer you see hiding in that asteroid belt are 6 dralthi fighters, a Kilrathi gangbang. -Devereaux

 

Online ksotar

  • 22
Re: Preliminary VR support. Help Needed with Barrel distortion
I feel like Invisible Man here.

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Preliminary VR support. Help Needed with Barrel distortion
Hop on the HLP Discord server and ask there.  Much faster.  Try the #scp channel, maybe?  Just ask in #general channel where to ask.  There's a bunch of people on now.