Jump to content

BABYLON.Augmented Reality ...


JackFalcon
 Share

Recommended Posts

Hello, under aFalcon energy, im working on porting ar.js to babylon.js

it got some questions. 

q. i would like to set the camera position.quaternion.scale in babylon ? how can i do that ?

q. i would like to change the FOV of the camera. how can i do that ?

q. i would like to put my own projection matrix for the camera. Not one recomputed with fov,near,far,aspect etc... One projection matrix 4x4 of mine. in theory it is already needed to support WebVR. How can i do that ?  

 

Thanks :)

Link to comment
Share on other sites

Wow, @jeromeetienne has come to visit.  WELCOME, JE!  Too cool. 

(He's a super-star of 3D land, ya know?  I say we build him a nice home on Lake Babylon, and stock-up his fridge with steaks and beer.)  :)

Nice to have you with us, JE!  Thanks for the contribs and comments. 

Now, enough of my superstar-drooling (Wingnut hugs JE)... it's time to get back on-subject.  :)

I have been thinking about Bluetooth-like things for AR.  For AR viewers, we might not always carry a database of AR-able things in the vicinity.  That means local AR-ables will need to transmit their existence... to the viewer/scene... perhaps with Bluetooth or similar. 

You turn your headgear-toward, or aim your camera-at... a city newspaper dispenser, for example.  The newspaper dispenser is transmitting "preferred AR representation data", and the phone/pad/headgear receives that, and uses it to identify and place the AR info into the view.

And yes, newspaper dispensers would need batteries, from then-on.  Self-identifying info-transmitting AR-ables.  hmm.  (I'm new at this AR stuff.  Can ya tell?)  :)

And, I didn't get back on-subject.  JE has questions.  Time to go to work.  camera.fov = whatever.  camera.fovMode = BABYLON.Camera.FOVMODE_VERTICAL_FIXED;   Here's a playground search for fovMode.  Search-in-code is handy.

I don't have answers for camera position quaternions (never heard of position quaternions, only rots)... and yes, setting your own viewMatrix SOUNDS like something we do regularly, but that doesn't mean that I know how to do it.  More comments from smarter people... coming soon.  But 'viewMatrix' is a good playground search term.  Talk soon.

Link to comment
Share on other sites

Great!  camera.fov works. (and it is in radian) learning babylon.js :)

yet another question :

q. how to make a plane visible on both side ? i tried what is below.. but the .twoSidedLighting = true doesnt change a thing for me. any hint ?

        var material = new BABYLON.StandardMaterial("texturePlane", scene);
        material.twoSidedLighting = true

Link to comment
Share on other sites

Here is  the current status - derived from @aFalcon example

 https://github.com/jeromeetienne/AR.js/tree/dev/babylon.js

in case somebody wanna look (and hopefully fix :) )

the conversion between three.js camera position and babylon one can be found here https://github.com/jeromeetienne/AR.js/blob/dev/babylon.js/examples/manual.html#L126-L161

 

Link to comment
Share on other sites

To make a plane with two  light reflecting faces, just set the optional parameter sideOrientation to the value BABYLON.Mesh.DOUBLESIDE at construction time

http://doc.babylonjs.com/tutorials/discover_basic_elements#side-orientation

http://doc.babylonjs.com/tutorials/mesh_createxxx_methods_with_options_parameter#plane

var plane = BABYLON.MeshBuilder.CreatePlane("plane1", {sideOrientation: BABYLON.Mesh.DOUBLESIDE}, scene);

If you want it simply visible from both sides, you can simply disable the backFaceCulling of its material

plane.material.backFaceCulling = false;

 

Link to comment
Share on other sites

Not sure to understand your need, but you can get the camera projection matrix from http://doc.babylonjs.com/classes/3.0/camera#getprojectionmatrix-force-rarr-matrix-classes-3-0-matrix-

var projMat = camera.getProjectionMatrix(true); // passing true forces the immediate computation before the rendering step

source :

https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.camera.ts#L442

Link to comment
Share on other sites

Hey, don't forget about us blind mad scientists... who do console.log(camera) and then use the browser object inspector to see all the "knobs and switches" on the camera.  (which we then blindly turn/throw, and see what blows-up).

Source?  What the hell is THAT?  :D

BTW:  Nice work, JE and assistants!  AR.js is lookin' sweeeeeeeet.

Link to comment
Share on other sites

Update: see video below

- i ported to the most recent ar.js api (which handle all tracking under a single API)

- i used babylonCamera.freezeProjectionMatrix(), seems to work

 

It is getting there. but still some issues. im not sure what is happening.

If people wish to step in and make it happen faster, the whole code is available here https://github.com/jeromeetienne/AR.js/tree/dev/babylon.js

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...