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.

Author
Message
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 27th Jun 2014 11:05 Edited at: 11th Oct 2014 22:02
I know the chances of this happening are worse than winning the lottery, but I would love to see Google Cardboard implemented into AGK.

After the inspiration of baxslash and the help of Hockeykid, I've been trying to build an AppGameKit version of Cardboard.

So far I've managed to control the 3D camera using the Rotational Sensors and the movement using either an XBox 360 controller or WASD on a keyboard plugged into a PC which enables you to do this:



If you don't know what Cardboard is, check this out:

https://gweb-cardboard.appspot.com/

Current working code:



To enable this to work, you'll need AppGameKit v2. You'll need to compile the app for both Windows and Android. Copy the apk file to your head-set device and then run both apps together.

You'll also need to run the app on a PC at the same time so that you can move the player using the Controller or the Keyboard.

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Jun 2014 11:28
yes, its cool, but it should be a graphics driver thing.

Atheer Labs vs MetaPro AR Glasses
https://www.youtube.com/watch?v=sPu_NqSTg_I

SpaceGlasses
https://www.youtube.com/watch?v=b7I7JuQXttw

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Jun 2014 12:07
I only have a few words to say about that:
Render To Image...
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 27th Jun 2014 13:36
Ah yes, we could code our own version.

Time for some experiments me thinks!

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Jun 2014 14:07
Good luck!
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 27th Jun 2014 22:26
And the experiment ends, unfortunately without access to the device's gyroscopes it's pretty near impossible to make an AppGameKit version of cardboard.

It's a shame the commands were only implemented for the ultrabook

Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 28th Jun 2014 10:33
Quote: "And the experiment ends, unfortunately without access to the device's gyroscopes it's pretty near impossible to make an AppGameKit version of cardboard. "


I was really looking forward to building my own Cardboard and giving it a try, so that's some bad news.

Anyways, I decided to alter the AppGameKit Player to add in gyroscope commands so that Tier 1 users can play with Cardboard.

However, while I was at it I decided to add support for more than just the gyroscope.


The AppGameKit Player attached to this post will allow you to use the following sensors on Android:

Gyroscope
Proximity Sensor
Light Sensor
Magnetic Field Sensor
Rotation Vector "Sensor"

Here are some AppGameKit Tier 1 functions that you can use in conjunction with my modified AppGameKit Player to get sensor data:



And here is a little test/example that outputs the sensor data:


I suggest trying the Rotation Vector functions, as they should return roll,yaw,pitch (I think).

It should also be noted "Sensor_GetProximity( )" returns a distance, however most devices just use the proximity sensor as simply "near" or "far" (For example: my Moto X returns "100.0" when nothing is close to it and "3.0" when something is near it).

If someone actually wants to build and APK using these sensors, let me know and I'll see if I can get it to work with Automate.

Please let me know how it works for you, and I hope to see some Cardboard compatible applications in the Showcase boards.


Sean

Attachments

Login to view attachments
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 28th Jun 2014 10:39
Sean you are awesome! Did you modify v108 or v2? I only ask as I need the render to image function from v2 to create the bifocal image on screen.

On another note, ever thought about doing a tutorial on how to modify the source for T1? Id love to know what you need to do to add my own functions.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 28th Jun 2014 10:55
@Hockeykid
wow, please give paul your source code for v2

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 28th Jun 2014 11:14
Sean, the example worked on my Sony Xperia SP - I agree the rotation vector is the way to go. I got a lot of cross readings as I rotated my phone about - i.e. it wasn't immediately clear to me which rotational axis "X" was as rotating the phone in one axis adjusted all three rotation values. I suspect I'll need to do a bit of trail and error to convert the rotation values to a nice camera movement.

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 28th Jun 2014 11:20
Another problem we have with this is that AppGameKit can only support 1 camera at present, so rendering two camera to two images isn't possible and I'm not sure it's even on the roadmap for v2.

Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 28th Jun 2014 11:38 Edited at: 28th Jun 2014 11:39
Quote: "Did you modify v108 or v2?"


I modified V108, however attached to this post is a V2 version of the player.

Quote: "Another problem we have with this is that AppGameKit can only support 1 camera at present, so rendering two camera to two images isn\'t possible and I\'m not sure it\'s even on the roadmap for v2."


You should be able to render one image, move the camera, and then render the second image.

I have some old V2 code here that might help:




Sean

Attachments

Login to view attachments
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 28th Jun 2014 12:37 Edited at: 28th Jun 2014 12:40
You can create a 2D game with 3D effects. I don't think it would be too difficult to do 2 screens using SetSpriteScissor(). By positioning sprites differently for each screen depending on depth, it should create a 3D effect.

Someone should manufacture something like this in cardboard or plastic and sell.

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 28th Jun 2014 23:54
Cheers for the extra code and player Sean!

I managed to control the 3D camera using the vector sensor values as shown in this quick video:



Here's the modified code from Sean's original example:



I'll try the V2 code now and see if I can get binocular vision to work.

Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 29th Jun 2014 04:44
Quote: "I'll try the V2 code now and see if I can get binocular vision to work."


Give this a try, I only tested on my PC and can't quite tell if it's working correctly:





Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 29th Jun 2014 11:35 Edited at: 29th Jun 2014 12:48
Funny enough I made something quite similar and I can get the two renders working, but I have two weird problems.

Here is the code:



The first is that the sprites don't fill the full height of the screen, despite being sized to do so. They fill the width correctly, but not the height.

The second is that I wanted to draw a centre line so they it was clear where the images were split, but the line is drawn way off where it should be. The coordinates are correct, but for some reason it is 75% off to the left and doesn't fill end at the bottom of the screen.



Apart from these bugs, the rendering seems to work well. I need to correct the camera positioning so that the 3D effect is correct. I've also managed to get hold of some lenses which I should be getting on Friday so next weekend will be the ultimate test for this.

Attachments

Login to view attachments
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 30th Jun 2014 02:02
Ok - figured out the line bug, i just needed to move the RenderToScreen before the line was drawn - the sprite height still annoys me though.

Anyway, despite this I've now tested the camera control within the example Metro Theater level:



Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 30th Jun 2014 02:59 Edited at: 30th Jun 2014 03:00
Quote: "the sprite height still annoys me though."


While you have the virtual resolution set to 1280x720, the draw area won't fill the screen because of your phone's on screen buttons. You'll need to use SetScissor( ) to correct for this.


I've modified your code, this should work:


Quote: " I've also managed to get hold of some lenses which I should be getting on Friday so next weekend will be the ultimate test for this."


I built my Cardboard yesterday, however the lenses won't get here until Thursday.





Sean

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Jun 2014 09:07
Love this project. It's like VR underground or something...
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 30th Jun 2014 09:12 Edited at: 30th Jun 2014 09:13
Cheers,

This is the 3D viewer I'm picking up:



edit: Nice crafting skills HK.

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 1st Jul 2014 02:08
And now with lateral movement using an xbox controller



Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 1st Jul 2014 14:44
So the current set up means you need to run the programme on both a PC (to enable joystick control) and a mobile (to get the binocular vision), but I think I could alter the code to enable you to run the same experience with two mobiles; with the second mobile replacing the PC and running a virtual joystick.

If one of the mobiles runs as a wifi hub, the whole thing could be portable

Oh and I'm thinking of calling this [I] Oculus Thrift [/I].

Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 1st Jul 2014 16:10
Quote: "Oculus Thrift"

Nice one
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 1st Jul 2014 16:47
Very cool work! I just ordered some lenses on Sunday and I'm just waiting for them to arrive.
I saw an article that called the Google Cardboard the "Mockulus Thrift". Haha!

Ron

a.k.a WOLF!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 3rd Jul 2014 14:30 Edited at: 4th Jul 2014 18:01
@HockeyKid> Would you mind sharing your code for the custom player that populates the memblock with the sensor data? I'm sure this would be useful for many users thinking about making the move to T2.

Thank you!

CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 8th Jul 2014 13:00
Sorry to bump, but I finished building a Google Cardboard last night! For anyone who's interested, I found some surprisingly good lenses at "Home Bargains" in the form of some camping binoculars! They were only £1.99 a pair. You need two pairs to get the focal length close enough for Cardboard. The 'big end' of the binoculars has 40mm plane convex lenses (they pop out really easily) which, when double up (put the flat sides together to form a single biconvex lens), you end up with something almost ideal for Google Cardboard!

I recommend the "Hiyoshi Jump" app for testing your new ultra low-budget VR Headset! Great fun

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Jul 2014 03:37
Wow, this is a really cool thread! Definitely the VR underground Hacking AppGameKit to death here just to get it working haha

RickV
TGC Development Director
24
Years of Service
User Offline
Joined: 27th Apr 2000
Location: United Kingdom
Posted: 4th Oct 2014 10:25
Hi,

You can now do this natively with AppGameKit V2 using the sensor commands. Are you able to update it?

Rick

Development Director
TGC Team
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 4th Oct 2014 10:41
Already on it

I just had some real world things to finish off first.

Watch this space.

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 5th Oct 2014 14:51
Ok I've updated this project to work with AGKv2. It was ridiculously easy to update and it enabled me to remove a lot of code.

I've attached the apk file you'll need to run on your device.

And the source code is here:



This demo is specifically designed to use the Metro Theatre models that are provided in the 3D demo. Because of copywrite i can't upload them here, so you'll have to copy the 3D media from the Demo folder and place it in your own media folder to get this to work.

I'll post a video of the AGK_VR in action in the next week or so.

Attachments

Login to view attachments
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 6th Oct 2014 01:19
Quote: "copywrite"


Sounds like some kind of OS filesystem function You mean copyright

Quote: "It was ridiculously easy to update and it enabled me to remove a lot of code."


And this is why we like AppGameKit

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 11th Oct 2014 22:03
Video as promised:



Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 11th Oct 2014 22:34
That's awesome! How good is the 3D effect?

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 11th Oct 2014 22:48
The effect was better than I thought it was going to be. You can customise it by changing the eye distance variable in the code.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 12th Oct 2014 00:07
Great fun!

I've always wondered what they did in Peterborough for entertainment on a Saturday night!!!!!!!

-- Jim - When is there going to be a release?
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 12th Oct 2014 05:59
How does it feel with the slow orientation update? I remember there being presets on android devices to set the update rate of the accelerometer but we don't have access to them in AppGameKit It seems like that would make me feel sick quite quickly.

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 12th Oct 2014 13:16
Don't worry Jim, straight after I made the video I went out for a spot of Cow tipping

Swissolo, I didn't really notice any lag in the orientation update. I remember seeing a delay with the Ultrabook commands that were added in v1, but these additional sensor commands in v2 are much better.

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 12th Oct 2014 18:22
Quote: "Swissolo, I didn't really notice any lag in the orientation update. I remember seeing a delay with the Ultrabook commands that were added in v1, but these additional sensor commands in v2 are much better."

Oh. Does it just not update as quickly on the PC end? When you were moving with the joystick and moving your head the frame rate seemed fine but the head movements seemed very jerky. (heh mooovements, Jerky. Didn't intend to put that in there )

Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 12th Oct 2014 20:01
Ah yes, the pc display is laggy, partly due to the screen capture software. There is no orientation lag in the headset, but there is the odd bit of lag with the 360 controller which I think is due to the wifi link.

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 12th Oct 2014 20:56
Quote: "Ah yes, the pc display is laggy, partly due to the screen capture software. There is no orientation lag in the headset, but there is the odd bit of lag with the 360 controller which I think is due to the wifi link."

Awesome! I'll have to try this out myself soon. I've been working on the other end of virtual reality (physical world to virtual world) so it would be very cool to pair them together

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 13th Oct 2014 04:07
Awesome video, Ched! The build quality of your Cardboard is a bit.... how shall I say this... dodgy... but everything else is cool!

I've got a pre-made Cardboard coming from Hong Kong by extra-snail-mail, so I'll make a video and experiment with AppGameKit as soon as that gets here

CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 10th Nov 2014 17:31
I found a complete pre-cut Cardboard kit on e-bay for just £1.95 (including lenses!). I placed an order last week and it says it'll take a couple of weeks to arrive. Item code is 361083040201 if anyone is interested (just search that number in ebay). I'll let you know what they are like when (if) they arrive!

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Nov 2014 21:19
Also just ordered my Cardboard Kit. I was amazed by this app when judging the competition last week...and that was without the Cardboard!

I went for this one.

Quidquid latine dictum sit, altum sonatur
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 10th Nov 2014 23:06
It would be good fun to modify one of these to point to two regions on a monitor. With a slight prismatic angle on the lens you could do quite high-res stuff.

-- Jim - When is there going to be a release?
Native Tech
11
Years of Service
User Offline
Joined: 19th Jul 2013
Location:
Posted: 11th Nov 2014 00:38
Damnn. Theres some talented ppl in this community.u guys r amazing

Native Technology
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 11th Nov 2014 01:17 Edited at: 11th Nov 2014 01:18
I have absolutely no experience with virtual reality whatsoever. Never even tried it or anything but it sure looks cool. Good luck!

Edit:
Typos...

Regards Sph!nx
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 12th Nov 2014 02:39
I got my Cardboard a couple of weeks ago. I bought it for about $3 (including postage!) from TinyDeals.com, so it took a few weeks to arrive, but it works perfectly. It has made me incredibly excited for the future of real VR devices, in particular the Rift!

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Nov 2014 12:47
My Cardboard arrived
I tested it on the Dive City Rollercoaster demo and it works really well.

Using it on the Metro Theatre demo, I can't quite get it right. I started by focusing on a bin in the corner, and it was out by about 4 feet (in Metro land dimensions), so I adjusted the EyeDistance until it was right. It's now at 35.0 (from the original 10.0)

Now this bin is looking correct, if I turn and look at things further away, they have the same problem as the bin had. Is there anything else I can adjust to get it right? I imagine you had the same tweaking to do when you first set it up.

Quidquid latine dictum sit, altum sonatur
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 12th Nov 2014 14:03
That's a weird problem. When I run it, the focus is fine. I had a mate test it too.

This is going to sound odd, but can you try looking at the scene with your head tilted on its side? I'm wondering if it is a trig problem.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Nov 2014 14:15
OK, I feel ill now

When I tilt sideways, it works at exactly 90 degrees, anything slightly off and it breaks apart again. I'm not sure if I then experienced the same problem with the floor, it was hard to tell.

Quidquid latine dictum sit, altum sonatur

Login to post a reply

Server time is: 2024-11-25 13:43:59
Your offset time is: 2024-11-25 13:43:59