Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot render webview in GearVR handset #81

Open
geoabensur opened this issue Jun 15, 2016 · 12 comments
Open

cannot render webview in GearVR handset #81

geoabensur opened this issue Jun 15, 2016 · 12 comments

Comments

@geoabensur
Copy link

I would like to know if unity-webview has support to render pages in VR handsets like GearVR. I have included this plugin in my unity VR app and webview was not rendered properly. Is there any plan to include it as texture or something like that?
Thank you very much

@KojiNakamaru
Copy link
Member

This plugin overlays system-provided webviews as is on unity's rendering and doesn't support the side-by-side/spherically-distorted display. An easy way might be to prepare some special web pages (cf. http://through-the-interface.typepad.com/through_the_interface/2015/01/integrating-web-based-vr-samples-into-a-native-google-cardboard-app-using-the-cardboard-sdk-for-android.html ). We could extend the plugin to generate webview textures as below, theoretically, but it would take long and the implementation would tend to be tricky...

  1. prepare a webview instance not attached to the activity's view.
  2. call webview.onTouchEvent(event), etc. to pump (pseudo) events
  3. call webview.draw(canvas) to generate a bitmap (cf. http://stackoverflow.com/questions/31344667/creating-bitmap-from-webview-with-content-offscreen-android )
  4. pass tex.GetNativeTexturePtr() to the plugin and call GLES20.glTexImage2D() for the bitmap.
  5. go to 2.

@KojiNakamaru
Copy link
Member

https://www.assetstore.unity3d.com/jp/#!/content/29346
EasyWebViewTexture For Android

Though I haven't tested, this might help.

@IanPhilips
Copy link

IanPhilips commented Dec 6, 2018

working on this project for android, it's a bit slow because it uses the cpu but hopefully will transfer to the GPU in the future. Btw, thanks @KojiNakamaru for the tips above, I followed them closely except the OpenGL stuff which will come in the future.

@KojiNakamaru
Copy link
Member

@IanPhilips
Thank you for sharing a nice project. Though you may already know, the followings should be useful to proceed further (I bookmarked them before but haven't been able to try yet).

https://coderwall.com/p/6koh_g/rendering-any-android-view-directly-to-an-opengl-texture
https://github.com/ArtemBogush/AndroidViewToGLRendering

@clovelt
Copy link

clovelt commented Dec 11, 2021

Been looking at these links, super useful! No progress yet, though. Any interest in pursuing 3D+VR rendering?

@KojiNakamaru
Copy link
Member

For other solutions, you can check #612 (comment).

@IanPhilips
Copy link

Just got pinged with the comment updates, my project works very well now. It's no longer based on the cpu and instead uses the gpu. You can watch videos, etc. in 3D. https://github.com/IanPhilips/UnityOculusAndroidVRBrowser

@clovelt
Copy link

clovelt commented Dec 14, 2021

Just got pinged with the comment updates, my project works very well now. It's no longer based on the cpu and instead uses the gpu. You can watch videos, etc. in 3D. https://github.com/IanPhilips/UnityOculusAndroidVRBrowser

Hey Ian! I discovered your project not very long after my comment, do you have any contact information? I made a UI and keyboard for it

@IanPhilips
Copy link

@clovelt any reason you can't submit a PR or issue on the repo? [email protected]

@HafizMSaad
Copy link

https://www.assetstore.unity3d.com/jp/#!/content/29346
@KojiNakamaru
this link is either broken or somehow not working for me.

@HafizMSaad
Copy link

@geoabensur
Could you please clarify what you mean by 'not rendered properly'? I'm encountering a series of errors when loading the sample(SampleWebView) scene from another scene on Quest 2:

NullReferenceException: Object reference not set to an instance of an object.
at UnityEngine.Transform.TransformPoint (UnityEngine.Vector3 position) [0x00000] in <00000000000000000000000000000000>:0
at Oculus.Interaction.Input.TrackingToWorldTransformerOVR.ToWorldPose (UnityEngine.Pose pose) [0x00000] in <00000000000000000000000000000000>:0
at Oculus.Interaction.Input.Controller.TryGetPose (UnityEngine.Pose& pose) [0x00000] in <00000000000000000000000000000000>:0
at Oculus.Interaction.Input.Visuals.OVRControllerVisual.HandleUpdated () [0x00000] in <00000000000000000000000000000000>:0

NullReferenceException: Object reference not set to an instance of an object.
at SampleWebView.b__3_0 (System.String msg) [0x00000] in <00000000000000000000000000000000>:0
at WebViewObject.Update () [0x00000] in <00000000000000000000000000000000>:0

NullReferenceException: Object reference not set to an instance of an object.
at SampleWebView.b__3_0 (System.String msg) [0x00000] in <00000000000000000000000000000000>:0
at WebViewObject.Update () [0x00000] in <00000000000000000000000000000000>:0

@HafizMSaad
Copy link

For those seeking VR-compatible solutions, I recommend checking out the following repository: https://github.com/TLabAltoh/TLabWebViewVR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants