How to change uOffset of VideoDome texture?

Hey there,

i want to change the uOffset of a VideoDome Texture to “rotate” the image by 90°.
You can look this up at this playground link:

In case 1 its working correctly. The texture is the diffuseTexture and i can change the uOffset of this texture an see the effect. This is the normal Mode and the texture is in default “Explicit” mode.

But in case 2 (which i need) it is not working. As soon as you set “useDirectMapping: false” so that you can change the “dome.fovMultiplier” a few other things change too. The texture is no longer a diffuseTexture but a reflectionTexture (why???). The texture mode changes from “Explicit” to “Fixed Equirectangular Mirrored”. In this mode, it seems like all Offset, Angle and Scale values of the texture are ignored. What’s bad, because uOffset is exactly the value i want to change in this mode.

So any ideas how to keep case 2 like it is(useDirectMapping: false, dome.fovMultiplier = 0.8), but change the Offset of the texture anyways?

Any help appreciated. Thanks.

Why not rotate the video dome directly instead?

Because we want to use it in VR. And as soon as the dome’s position and rotation are not exactly at (0,0,0) you get this weird zoom effect like described here: Zoom-in and -out effect while rotating head in VR

So we wanted to rotate the dome by changing the uOffset of the texture directly. Which works perfectly in case 1 but not in our case.

Pinging @RaananW to see if he has some cycles to have a look

hey, i just looked up the source code and it seems like the default rotation of the camera in VR is rotated by 90°. But why is it not at 0 like you would expect it to be. You can look this up here (line 29 defaultCameraOrientationY: -Math.PI / 2,): Extensions/amp-360video.ts at f859d23dea6367b9c3c245dc7a36cb04da1ed91c · BabylonJS/Extensions · GitHub
It seems like your preview 360 video of the tractor (which i used in my playground too) is also rotated by 90°. So the right side of the video is centered as default. But (i might be mistaken) as far as i know, the center of a 360 video should be at front. (not the right side)

pinging @sebavan

This is actually a good question and I wonder if we should update the defaults or keep it as it is ???

Actually the amp plugin code is the one rotating it to fit with the center of the video.

We simply do dome.rotation.y = Math.Pi / 2; as a workaround.

@RaananW @Deltakosh do you think we should change the default in the risk of breaking back compat ?

Well this is tricky and I would prefer not changing that to be honest as we have an easy workaround

1 Like

I did some XR experimenting -

This scene changes the location and position of the camera once every second. The image seems to stay correct and not distorted. Is it possible for you to use XR and test it? or are you trying to use an orientation-camera?

Hey, Sorry for the late response (was on vacation).

I just wanted to try your playground link, but when i open it with google chrome and click on the “enter VR” Button i just get “error” (what i almost expected). But when opening it with Firefox i just get this error in the console : TypeError: this._xrNavigator.xr is undefined ( babylon.js:16:1137902)
And no enter VR button is showing, so i cant test your code.
When i try running your “Mansion Demo” for XR ( I get exactly the same error and cant test it either.

Oh, we all were :slight_smile: welcome back.

Firefox does not support webxr yet,

and this is the error. The only browser currently supporting proper specs is chrome (and soon Chromium-Edge).

Having said that - WebXR is the future. WebVR was already removed(!) from chrome, so i wouldn’t develop using it. And WebXR is constantly updating and receiving new features.

Thanks for the fast response.

But as I said, when using Chrome and i click on the button in the lower right corner, to enter XR (in the playground link you provided) nothing happens but “Error” gets displayed on the button and the console logs : “The specified session configuration is not supported.” So what do i have to do, to test it correctly?

That means that the device is not configured correctly. What device are you using?

Oculus Rift

Oh, I had a lot of problems with the oculus rift, but I eventually got it to work. A few tips:

  1. make sure unknown sources is enabled in the oculus settings
  2. make sure oculus flag is enabled in chrome flags
  3. play with the sandbox and openxr flags in chrome, i dont remember what configuration i managed to get to work, but this was the culprit in my case. Dont forget to restart the browser every time…

okay i will have a try. But this does not seem very userfriendly to me. As a developer it might be okay, but i cant expect users of the site to check all their settings and test around :smiley: This seems like a big contra point for webxr at the moment, because webvr in firefox works right away, without changing any settings.

webvr is deprecated, webxr is being developed and officially only supported by windows mixed reality devices and chrome. This is the current state, sadly…

Give it a few months and it will look different. Things are changing rapidly.

I’ll give you that - I dont think they should have deprecated WebVR by the most-used browser in the world, before webxr is final. But they did :slight_smile: