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 Classic Chat / VR Distorted Mesh Method Demo! Based on Google CardBoard method.

Author
Message
Stab in the Dark software
Valued Member
21
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: 23rd Jul 2018 12:47
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.

P.S. This does not require the VR DLC sold by TGC.
The coffee is lovely dark and deep,and I have code to write before I sleep.

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 10th Jun 2017 12:34 Edited at: 12th Sep 2017 16:20
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

to


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
Stab in the Dark software
Valued Member
21
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
21
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
20
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 ):
Stab in the Dark software
Valued Member
21
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.




The coffee is lovely dark and deep,and I have code to write before I sleep.
CJB
Valued Member
20
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
21
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
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 19th Jun 2017 15:18 Edited at: 12th Sep 2017 16:20
Maybe you want to try my FXAA shader
Ron Erickson
Moderator
21
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
21
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.
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 12th Sep 2017 14:24
Hi, Stab in the Dark software:

Can i use your code from here in GG Loader ? , i think it would be a great addition ? ( would hate to start from scratch ), i will sent you a beta if/when i add it
best regards Preben Eriksen,
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 12th Sep 2017 15:31
Of course you can that's why I posted it.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 12th Sep 2017 21:26
Thanks Stab

Works great , just got one "stupid" question ( sorry dont have anything to test it on yet ) , if you look at the screenshot , the crosshair do not hit the same target , depending on you see with the left or right eye , so where do i sent the bullet ? center ? or what do the eye exactly see/target

best regards Preben Eriksen,

Attachments

Login to view attachments
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 12th Sep 2017 21:46 Edited at: 12th Sep 2017 21:47
lol that's why the crosshair should be on the 2D surface of the rendered global image (same crosshair at center of each eye), not in the 3d world (as your printed text is)
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 12th Sep 2017 21:53
Very exciting! There's something strange going on with the hand/gun - it looks a bit odd, like the depth effect is somehow broken for the hand and gun, but re the crosshair: I'd think the bullet should go exactly between the two. Can you post a vid of this in action?
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 13th Sep 2017 16:25
CJB: Gun is wip , done a video , and its uploading

MikeMax: I would expect that you then would see the crosshair 2 times ( everything else is not in the exact position, depending on the eye camera ) ? , anyway perhaps its better to wait until im able to test it myself, so i can see if all my questions are totally stupid
best regards Preben Eriksen,
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 13th Sep 2017 17:13
CJB: video done
https://forum.thegamecreators.com/thread/216912?page=4#msg2609493
best regards Preben Eriksen,
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 13th Sep 2017 18:30
@Preben
Did you try permanent scaling on the bone-animated meshes ?
Also the cross hair gets a 3D component if the position is different for the two render images.
Which is totally fine ! (Your brain will make it the center)
Quote: "so where do i sent the bullet ?"

Actually you should know best where the bullet travels
SteveMc
8
Years of Service
User Offline
Joined: 23rd Jul 2016
Location: UK
Posted: 15th Sep 2017 12:51
Hi There,

Just tested your later sample on a MagicSee AIO M1 VR Headset (Android 5.1, NIBIRU 2.1 VR Interface), works very well on both Barrel Plane. no distortion and the quality is actually better than the apps supplied with the device, very comfortable to view.

The M1 has a collection of hardware buttons U D L R Select & Back all map to GetRawKeyPressed.

I will be receiving the newer M2 & M3 in the coming weeks and months so I'll let you know how it works on those.

If you want the NIBIRU interface to recognise your app as a VR app you need to add a line to the AndroidManifest.xml

<category android:name="com.nibiru.intent.category.NVR" /> between <intent-filter> and </intent-filter>

It would be better too if the initial loading text was also displayed in VR as this headset is an 'Always In VR mode' headset. and flicking between VR > Normal > VR whilst on your head is rather disconcerting...

My only issue is with the compiled APK, something I've come across in my own app, where on END, the gyro is not being released, not a big problem on a phone but it is a big problem on an All In One device that relies on the gyro for its normal operation, however, I've created another thread for this.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 07:53:08
Your offset time is: 2024-11-24 07:53:08