Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Chat / VR Distorted Mesh Method Demo! Based on Google CardBoard method.

Author
Message
Stab in the Dark software
Valued Member
14
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 9th Jun 2017 22:27 Edited at: 9th Jun 2017 22:37
I have developed a better faster way to do VR for mobile devices.
This is compared to the pixel shader distortion method.
This article explains the difference and is what I based this Demo on.

http://smus.com/vr-lens-distortion/

This method uses 2 pre distorted object planes to set the render image too.
Since the UV data of the vertices of the object planes are distorted it distorts
the image applied to it. This is the best method for mobile VR. I have gotten good
results with an LG Stylo 3 running Android 7.0 and a Tzumi Dream Vision headset. I would appreciate
if other members of the community could test this on other mobile devices and OS and
post the results.
The demo by default uses a object plane distorted by 25% which should work for most Headsets.
If you find that the distortion is too much for your lenses try the object planes distorted by 12.6 %.
The Magnetic switch will move the camera forward in the demo.

I have attached the Demo.
The coffee is lovely dark and deep,and I have code to write before I sleep.

Attachments

Login to view attachments
janbo
8
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 10th Jun 2017 12:34 Edited at: 10th Jun 2017 12:35
Hey, I tested it on my Honor 8 .
You missed a essential part of VR ...you need to render the scene two times for the left and right eye, with the camera at the corresponding eye positions like I did
also you better render the 3D scene only then
+ Code Snippet
to
+ Code Snippet

I also could imagine to write a function to create the lenses via memblocks so you could alter the curvature and quality(amount of polygons of the mesh) in the code.

The rest works well

Using AGKv2 Tier1
Stab in the Dark software
Valued Member
14
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 11th Jun 2017 17:20
Janbo, Thanks for testing.
Quote: "You missed a essential part of VR ...you need to render the scene two times for the left and right eye, with the camera at the corresponding eye positions like I did
also you better render the 3D scene only then"


I have done some research and testing on Inter pupillary distance and Stereopsis and have found there to be no good
solution in mobile VR. Using Inter pupillary distance when rendering two different images is used to create Stereopsis.
From my research most people do not need 2 slightly different images to perceive Stereopsis. In this demo rendering
two different camera views gains no noticeable difference in Stereopsis and actually causes a severe distortion and stutter to the rendering.

You are correct I should just use Render3D() instead of Render(). I plan on not using 2D at all and instead using 3d object planes in scene for
the HUD and menus. This is the same method use by Google cardboard demos.

Quote: "I also could imagine to write a function to create the lenses via memblocks so you could alter the curvature and quality(amount of polygons of the mesh) in the code."


I did consider this but found it unnecessary as most head sets lenses are the same, so no need to change the distortion.
If you apply a graph image to the distorted planes and look at it in your headset all the lines should be straight if it is the
correct distortion for your lenses.

The one improvement I could make is to increase the vertex count of the object planes to increase the resolution of
the distortion. I will do further testing to determine if it makes a noticeable difference. The object planes are distorted
using a inflate equation and then flattened to the plane which is what Google Cardboard does. It does not use the standard
Barrel distortion equation which is not correct for VR and causes a swirl distortion in the center of the view when rotating and moving the camera.

The attached screen shot shows this demo in action.





The coffee is lovely dark and deep,and I have code to write before I sleep.

Attachments

Login to view attachments
Stab in the Dark software
Valued Member
14
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 13th Jun 2017 15:13
Does anyone else have a VR headset that could test this and post their results?
The coffee is lovely dark and deep,and I have code to write before I sleep.
CJB
Valued Member
13
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 13th Jun 2017 22:56
Quote: "two different camera views gains no noticeable difference in Stereopsis and actually causes a severe distortion and stutter to the rendering."

...but without it, there is no 3d effect.

I tried adding an offset, and I think the effect is improved (no distortion or stuttering that I can see ):
+ Code Snippet
Stab in the Dark software
Valued Member
14
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 15th Jun 2017 14:52
CJB

I stand corrected, your method does work with out distortion or stuttering.
Now I can see the 3D effect. I forgot about the local commands and was unaware that the setcameraposition()
command removes any local offset. I have updated the demo code here because I added
joystick control of movement.

+ Code Snippet


The coffee is lovely dark and deep,and I have code to write before I sleep.
CJB
Valued Member
13
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 15th Jun 2017 15:31
Nice! Great to see someone pushing the VR capabilities of AGK. Mapping the render image to a barrel mesh is a really nice solution. My only suggestion would be to somehow anti-alias the edges (or maybe just overlay something to fade the edges out?). Some quite harsh jagged edges - at least on my duff old mobe! Would probably not be so bad with a decent resolution screen!

Good work Looking forward to seeing where this goes.
Stab in the Dark software
Valued Member
14
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 19th Jun 2017 14:24
Quote: " My only suggestion would be to somehow anti-alias the edges (or maybe just overlay something to fade the edges out?). "


I did call SetAntialiasMode( 1 ) but I think it does not work on Android.
In my headset I can not see the edges because my phone has a large screen so it
may not be a problem for most users. I was hoping that more people would test.
The coffee is lovely dark and deep,and I have code to write before I sleep.
janbo
8
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 19th Jun 2017 15:18
Maybe you want to try my FXAA shader

Using AGKv2 Tier1
Ron Erickson
Moderator
14
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 21st Jun 2017 13:55
Quote: "I did call SetAntialiasMode( 1 ) but I think it does not work on Android."


The problem is that anti-aliasing doesn't currently work on render images.

Ron
a.k.a WOLF!
Stab in the Dark software
Valued Member
14
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 26th Jun 2017 16:04
Quote: "The problem is that anti-aliasing doesn't currently work on render images. "


It is not the render image that it needs to work but the objects instead.

Has anyone else tested with different hardware?

The coffee is lovely dark and deep,and I have code to write before I sleep.

Login to post a reply

Server time is: 2017-08-18 02:10:52
Your offset time is: 2017-08-18 02:10:52