googlevr / gvr-unity-sdk

Google VR SDK for Unity
http://developers.google.com/vr/unity/
Other
2.71k stars 1.09k forks source link

This SDK is a pure dissapointment, Camera FOV, Rendering to texture etc. etc. #937

Closed zenhund74 closed 6 years ago

zenhund74 commented 6 years ago

Summary:

I'm working with the Google VR Unity SDK since several weeks, but I have never expirienced such a frustrating experiment in my live.

First things first:

Your script does the very same, without showing this in the Unity hierarchy.

Secondly: It is absolutely non acceptable that the camera FOV parameters cannot be influenced at all anymore. I tried scripts (Camera,fieldOfView), scale, I even enlengthend the neck in your beautifull GvrEditorEmulator script, to get the camera closer to a cylindrik screen, I wanted to show simple panorama pictures with.

Ok, doesn't work (most works in the editor, nothing in the build). Lets render to texture then, take another camera and film a screen, wtih the fixed FOV, that you cannot change. Doesn't work.

I've seldomly found any software/sdk or other solution that frustrated me so much in my design process.

Found using:

Steps to reproduce the issue: 1 Try to render cylindrik

Workarounds:

non available

Additional comments:

I stop working with the SDK and wasting my time trying to find workarounds today.

rusmaxham commented 6 years ago

When you offer a script like the GvrEditorEmulator you should consider that Unity has a logical parent / child structure where transforms from parent objects inherit to children. Your script does the very same, without showing this in the Unity hierarchy.

We'll look into making this work more Unity-like.

It is absolutely non acceptable that the camera FOV parameters cannot be influenced at all anymore.

This is a feature of VR common to all VR SDKs. It is enforced at the Unity level, not our SDK. Camera projection params are dictated by the geometry of the VR headset. For rendering to texture, set the camera's Target Eye to None, then your changes to FOV will not be overridden.

fredsa commented 6 years ago

@zenhund74 I'm sorry you're having trouble with the SDK.

When in VR, field of view and lens distortion are dictated by the hardware: physical dimensions of the headset, position and shape of lenses, etc. Different HMDs / viewers can and do have very different FOVs.

The reason Unity locks the FOV in VR to the headset's actual FOV, is that the world wouldn't look like if you were able to adjust the camera FOV. You would see the world "swimming" as you turn your head. That is, you'd find that the world faster or slower than it should when you turn your head, which is the effect you'd see if you were say looking through a round fish bowl filled with water.

The easiest way to create a "zoom" effect is to use game object scale:

  1. Create a new parent game object called, say, "Camera Holder".
  2. Attach the Main Camera and any of its sibling game objects under the new "Camera Holder".
  3. Adjust the local scale of the "Camera Holder" to create the effect of scaling the player relative to the world.

This has the effect of "shrinking" the player to be smaller (think seeing the world as an ant would) or "enlarging" the player (think seeing the world as a giant would).

You should find that this effectively changes how things look and is almost like adjusting the FOV for flat screen content.

Hope that helps.

zenhund74 commented 6 years ago

Works fine in the editor, but not in the build. Thank you for your brief answer thoug.

Fred Sauer notifications@github.com schrieb am Mi., 11. Juli 2018 19:16:

@zenhund74 https://github.com/zenhund74 I'm sorry you're having trouble with the SDK.

When in VR, field of view and lens distortion are dictated by the hardware: physical dimensions of the headset, position and shape of lenses, etc. Different HMDs / viewers can and do have very different FOVs.

The reason Unity locks the FOV in VR to the headset's actual FOV, is that the world wouldn't look like if you were able to adjust the camera FOV. You would see the world "swimming" as you turn your head. That is, you'd find that the world faster or slower than it should when you turn your head, which is the effect you'd see if you were say looking through a round fish bowl filled with water.

The easiest way to create a "zoom" effect is to use game object scale:

  1. Create a new parent game object called, say, "Camera Holder".
  2. Attach the Main Camera and any of its sibling game objects under the new "Camera Holder".
  3. Adjust the local scale of the "Camera Holder" to create the effect of scaling the player relative to the world.

This has the effect of "shrinking" the player to be smaller (think seeing the world as an ant would) or "enlarging" the player (think seeing the world as a giant would).

You should find that this effectively changes how things look and is almost like adjusting the FOV for flat screen content.

Hope that helps.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googlevr/gvr-unity-sdk/issues/937#issuecomment-404245740, or mute the thread https://github.com/notifications/unsubscribe-auth/AnM3TwE-LChv0-4eT8S5e5m-ERlJtmUDks5uFjLtgaJpZM4VKmh5 .

fredsa commented 6 years ago

Understood. The fact that you can change some values in the editor is confusing at best.

One thing we could consider is adding some in-editor only script that at runtime checks any enabled VR cameras (often simply the main camera) and looks for changes to the FOV. We could then issue a warning explaining that FOV will not be changeable in VR, and suggest the scaling solution I mentioned above instead?

Would that have helped you?

zenhund74 commented 6 years ago

Thank you very much for your answer. I will try it asap. (writing your own headtracking algorithm is a little time consuming as well). Quaternation greetings, zenhund74.

Rus Maxham notifications@github.com schrieb am Mi., 11. Juli 2018 18:57:

When you offer a script like the GvrEditorEmulator you should consider that Unity has a logical parent / child structure where transforms from parent objects inherit to children. Your script does the very same, without showing this in the Unity hierarchy.

We'll look into making this work more Unity-like.

It is absolutely non acceptable that the camera FOV parameters cannot be influenced at all anymore.

This is a feature of VR common to all VR SDKs. It is enforced at the Unity level, not our SDK. Camera projection params are dictated by the geometry of the VR headset. For rendering to texture, set the camera's Target Eye to None, then your changes to FOV will not be overridden.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/googlevr/gvr-unity-sdk/issues/937#issuecomment-404240118, or mute the thread https://github.com/notifications/unsubscribe-auth/AnM3T6pNWGn_-LkAt9MDnhDi1hk8QDiEks5uFi56gaJpZM4VKmh5 .

zenhund74 commented 6 years ago

Hello Rus, hello Fred,

I tried the rendering to texture settings you recommended, but without success. Also when I use a Main Camera and give it "Both" eyes in my scene, the screen in the build will just stay black.

If I give it left or right eye it works fine.

I uploaded my Unity project to my google drive, so you can take a look at it.

https://drive.google.com/file/d/1LFi0TTrWyr4n7LeUjrhd5ynsLn0k-4U9/view?usp=sharing

Some short comments to the project:

As you can see, I used a scaling script (only worked in the editor), I tried to enlengthen the "neck" vector in GVREditorEmulator Script(also worked in the editor), I tried to animate the camera position and parameters(as well), nothing reached my goal, to have the picture from the camera a little bit bigger, so you don't see the ceiling and the floor, unless you loook up or down, like in the original cardboard camera app.

I'm learning in a Unity course these days, and I cannot proceed with this project, as it becomes to time consuming trying to find workarounds.

Maybe you find a different way to deal with this problem. Render to texture was my last idea how to solve.

Kind regards, Jens.

2018-07-11 19:28 GMT+02:00 Jens Hellermann zenhund74@gmail.com:

Thank you very much for your answer. I will try it asap. (writing your own headtracking algorithm is a little time consuming as well). Quaternation greetings, zenhund74.

Rus Maxham notifications@github.com schrieb am Mi., 11. Juli 2018 18:57:

When you offer a script like the GvrEditorEmulator you should consider that Unity has a logical parent / child structure where transforms from parent objects inherit to children. Your script does the very same, without showing this in the Unity hierarchy.

We'll look into making this work more Unity-like.

It is absolutely non acceptable that the camera FOV parameters cannot be influenced at all anymore.

This is a feature of VR common to all VR SDKs. It is enforced at the Unity level, not our SDK. Camera projection params are dictated by the geometry of the VR headset. For rendering to texture, set the camera's Target Eye to None, then your changes to FOV will not be overridden.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/googlevr/gvr-unity-sdk/issues/937#issuecomment-404240118, or mute the thread https://github.com/notifications/unsubscribe-auth/AnM3T6pNWGn_-LkAt9MDnhDi1hk8QDiEks5uFi56gaJpZM4VKmh5 .

fredsa commented 6 years ago

Jens,

Instead of using a render texture and additional cameras with custom FOV (which is going to lead to the feeling of the world "swimming" when users move their head, can you try the steps I mentioned above?

The easiest way to create a "zoom" effect is to use game object scale:

  1. Create a new parent game object called, say, "Camera Holder".
  2. Attach the Main Camera and any of its sibling game objects under the new "Camera Holder".
  3. Adjust the local scale of the "Camera Holder" to create the effect of scaling the player relative to the world.
zenhund74 commented 6 years ago

Hello Fred,

as I mentioned, I had a script doing that on the parent object, which is needed anyway to avoid inheriting the transform from the GVREditorEmulator.

Please read my e-mails before you answer two times the same advice. It was working in the editor, but not in the build. Also, this is no explanation why important functions like rendering to texture don't work at all.

Your SDK is buggy, not fully featured.

Kind regards, Jens.

2018-07-12 20:08 GMT+02:00 Fred Sauer notifications@github.com:

Jens,

Instead of using a render texture and additional cameras with custom FOV (which is going to lead to the feeling of the world "swimming" when users move their head, can you try the steps I mentioned above?

The easiest way to create a "zoom" effect is to use game object scale:

  1. Create a new parent game object called, say, "Camera Holder".
  2. Attach the Main Camera and any of its sibling game objects under the new "Camera Holder".
  3. Adjust the local scale of the "Camera Holder" to create the effect of scaling the player relative to the world.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googlevr/gvr-unity-sdk/issues/937#issuecomment-404600731, or mute the thread https://github.com/notifications/unsubscribe-auth/AnM3TzfQnRweSeMxwX5RHZHUmmpWd25Yks5uF5CJgaJpZM4VKmh5 .

fredsa commented 6 years ago

@zenhund74 My understanding is that you wanted to adjust FOV. However, although setting FOV appeared to work in editor, you found that FOV cannot be adjusted in VR mode while running on the device.

Moreover, I understood that you were only trying to use a render texture in order to workaround the fact that FOV cannot be adjusted in VR mode.

I mentioned the same advice (to set the local scale of game object that is a parent of the main camera) twice, because I think it's easiest way to get a zoom effect that's most like what FOV would be for non-VR applications.

Using additional cameras and render textures is possible, and would allow you to hack around the FOV restrictions in VR, but doing so is not going to be a good experience for users:

On the other hand, adjusting the scale of the camera's parent transform component will effectively grow/shrink the user, so that the world appears smaller or larger, and the world will rotate normally when the user rotate's their head.

(If you still want to try the secondary cameras and render textures, you can do so. However, there's nothing specific in the Google VR SDK that will affect whether you can do so. In fact, you can do this in a new project where you don't import the Google VR SDK. Just setup your game objects and scripts as desired, make sure "cardboard" is the only VR SDK listed in Player Settings > Android > XR Settings > VR SDKs, then run on device.)