GameMonetize Posted August 3, 2017 Share Posted August 3, 2017 Babylon.js is left handed by default but you can force the scene to be right handed with scene.useRightHandedSystem = true JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted August 3, 2017 Author Share Posted August 3, 2017 Ah-ha! Left-handed by default -> me too... Great reminder -> use Right Handed System ... sometimes. Interesting effect. Flipped the y-axis... This may help what I was seeing, and with the colored axis, it helps... Thank you. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 5, 2017 Share Posted August 5, 2017 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 JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 5, 2017 Share Posted August 5, 2017 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. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 5, 2017 Share Posted August 5, 2017 Thanks for this warm welcome JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 5, 2017 Share Posted August 5, 2017 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 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 5, 2017 Share Posted August 5, 2017 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 JackFalcon and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted August 5, 2017 Share Posted August 5, 2017 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; JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 7, 2017 Share Posted August 7, 2017 For double sided lighting you can also rely on the shaders with mesh.material.twoSidedLighting = true; JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 7, 2017 Share Posted August 7, 2017 Something like that: https://www.babylonjs-playground.com/#G4YIXN Wingnut and JackFalcon 2 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 10, 2017 Share Posted August 10, 2017 q. i would like to put my own projection matrix for the camera. Not one recomputed with fov,near,far,aspect etc... This is a projection matrix 4x4 issues from camera calibration. in theory it is already needed to support WebVR How can i do that ? Thanks JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 10, 2017 Share Posted August 10, 2017 Here is a video of the current status. position/rotation/scale seems to work (using scene.useRightHandedSystem = true) I still need to push the custom projection matrix, and then to handle resize. brianzinn, jerome, NasimiAsl and 1 other 4 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 10, 2017 Share Posted August 10, 2017 ping @Deltakosh JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted August 10, 2017 Share Posted August 10, 2017 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 JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 10, 2017 Share Posted August 10, 2017 thanks @jerome in my case i want to *Set* it tho. aka i got the matrix, and i would like babylon.js to use mine PS: thank for the source. definitly useful JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 10, 2017 Share Posted August 10, 2017 @Deltakosh could i use freezeProjectionMatrix by anychance ? https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.camera.ts#L431-L436 JackFalcon and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 10, 2017 Share Posted August 10, 2017 This is exactly what you need to use camera.freezeProjectionMatrix(yourMatrix) JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted August 10, 2017 Share Posted August 10, 2017 cool, someone finding his own answers directly in the source JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 10, 2017 Share Posted August 10, 2017 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? BTW: Nice work, JE and assistants! AR.js is lookin' sweeeeeeeet. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
JackFalcon Posted August 10, 2017 Author Share Posted August 10, 2017 - slight correction afalcon-power merely extends @Wingnut energy. Cheers... Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 10, 2017 Share Posted August 10, 2017 i wait for @jeromeetienne i start make some wild stuff with that JackFalcon and brianzinn 2 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 11, 2017 Share Posted August 11, 2017 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 Wingnut and JackFalcon 2 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 11, 2017 Share Posted August 11, 2017 More and more progress. now the babylon sphere is on top of the marker JackFalcon, Dad72, jerome and 2 others 5 Quote Link to comment Share on other sites More sharing options...
jeromeetienne Posted August 11, 2017 Share Posted August 11, 2017 Going well Fixed issue: - marker position properly copied - use projection matrix from calibrated cameras Remaining issue: - handling window resize JackFalcon and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 11, 2017 Share Posted August 11, 2017 Woot woot woot!! I would love to make it an official extension. How do you plan to distribute the code? Rely on your github? We could leverage our doc for isntance to help people using your awesome work JackFalcon and Dad72 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.