Jump to content

Change FOV of VRDeviceOrientationFreeCamera?


nikokoneko
 Share

Recommended Posts

Hi all, this is my first post after working with Babylon JS for a few months already, and at first I would like to express gratitude to all contributors who made this great engine possible.

Now for the question. For a few days I have been trying without success to get good results using VRDeviceOrientationFreeCamera on a simple Google Cardboard.
In the end, I decided that I could go without barrel distortion effect (which pretty much doubles the frame rates), but now I am stuck with a camera which FOV is too large (too wide-angle), and it makes for a very disorienting experience. Apparently .fov property does nothing on VRDeviceOrientationFreeCamera ( correct me if I am wrong ?!), so how can I change the lens (fov) ?

I tried to use RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED instead of VR rig, which makes .fov property working again, but it results on some strange scaling issue plus it doesn't react to roll rotation. I also played with all VRCameraMetrics properties, none made any effect on the field of view.

Thanks for your help.

 

 

Link to comment
Share on other sites

Hiya Niko!  Welcome to the forum!

http://www.babylonjs-playground.com/#1TT4LL#1

I made a little scene.beforeRender animator (val -1 to +1), and tried making "pokes" (sets)... on camera._rigCameras[*].fov  (lines 55 and 56).  hehe.  It was a deep demented attempt and didn't work.  :)  Oh well.  Lines 53 and 54 work (need to activate line 57, too).  They do something, but you have already done tests on the metrics.

Aw heck, let's activate line 53 and 57 and see what it looks like.

http://www.babylonjs-playground.com/#1TT4LL#2

Not very exciting, huh?  *nod*   hmmm.  Let's keep playing/experimenting... and invite others to play, too.  C'mon everyone, play with our playground... make more saves, see if we can get something that Niko can use.

I dunno why I couldn't make settings to camera._rigCameras[0].fov and camera._rigCameras[1].fov.  Not only did it fail, but I got no smoke, sparks or explosions.  How boring.  :D

Link to comment
Share on other sites

Hey Wingnut! Thanks for your reply - that is a fun playground :) !

Yeah, some internal piece of code seems to be overriding the .fov values for camera. And what's worse, it seems to be a hard-coded value, since I've found absolutely no property that would affect camera field of view in any possible way. Really looking forward to resolve this quickly, otherwise I will have to switch to Google VR View + Three.js, and I really prefer Babylon.js, a lot!
 


 

Link to comment
Share on other sites

Nah, you don't want to deal with 3JS... they're all a bunch of drunks over there.  :D

Oh wait, maybe I'm thinking about ME. 

To be frank, I don't even know what "field of view" IS... when dealing with stereoscopic rigs.  metrics.interpupillaryDistance and metrics.lensSeparationDistance are not what you are seeking, though, apparently.  Even if we DID get standard .fov working for both rig cameras... I don't think THAT is what you are seeking, either.

I would have thought .interpupillaryDistance == fov (for stereo rigs).   But I guess that might be considered "cross-eyed-ness", huh? 

Wait, isn't cross-eyed and wall-eyed... the FOV for stereo rigs?  err... no... I'm repeating myself.  I don't have much experience in this new fancy stuff.

I probably should have left this one for @davrous.  He gave you a LIKE, but then he didn't have an answer.  I hope your question didn't give him a brain tumor.  :)  But, don't you worry at all about a BJS solution.  It's all JS.  EVERYTHING is customize-able... if you have a little patience, time, and diligence... to learn about camera rigs.  Everything is here.  We just need to mix the correct dangerous chemicals together.  :)

Meantime, what the heck do you mean by FOV, Niko?  If you DID get individual control of standard .fov property on both rig cams... do you think THAT would fix your issue?  If you feel like talking some more... I would surely listen, and perhaps others would, too.

Link to comment
Share on other sites

Haha, then I'm in a good company here!

As for the FOV, changing field of view is basically analog to taking a real-life camera doing the zoom in/zoom out. So yes, I would like to be change FOV to stereoscopic rig the same way I would do with the normal camera.
Here's a quick playground that switches between the two fov values (for a "normal" single camera).

http://www.babylonjs-playground.com/#VMQKL#0

So by default, with stereo rig I get a view similar to what I call "BAD" view here. A very wide angle lens, showing distractedly huge amount of scene. I would like to change FOV to get something similar to "GOOD" condition here.
 

Now here's the reasoning behind why I think I need to change FOV manually.

I am aware that to get a real immersive experience the best way to go is with the barrel distortion compensation, but this is not applicable here because:

- Barrel distortion compensation post-render shader basically cuts the performance in half, making it unusable on mobile.

- I find the VRCameraMetrics impossible to tweak to make barrel distortion work on a Cardboard (if anyone has good values, or method to convert/calculate Carboard parameters into VRCameraMetrics  I'd be willing to hear). 
When wrong barrel distortion is applied, the result is way worse than no barrel distortion at all - basically it's impossible to focus your eyes on anything in the scene. You keep seeing two different scenes all the time.

When distortion compensation is off, things are not perfect, but it looks way better than the compensation with the wrong parameters.
The only distracting thing with the compensation off is that the scene has unnaturally wide field of view - hence my attempt to hack FOV to get slightly more natural results.
I am aware that in real life we are not able to "zoom" with our eyes (yet!) but I am not looking for scientifically accurate simulation, just something that looks fairly convincing.

I hope my explanation makes sense. Bottom line is - I just want to make this work with Cardboard, one way or another... :)

Thanks! :)

 

 

 

 

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...