HtmlElementTexture does not work on WebXR?

Hello everyone, and thanks for the help in advance.

I have a working HtmlElementTexture, but when I go into WebXR, the texture stops updating. Is there any way of making it work? PG below.


good question for @sebavan and @RaananW

2 possibilities, either in XR the browser stops rendering the canvas 2d or the onBeforeRenderObservable is not called.

I would suspect the first one as we are using canvas2d for the gui in VR without issues. I wonder how your particle framework handles the request animation frames which might be highly different in VR.

cc @RaananW

There is actually no reason for the texture to not update. Looking at the (minified) code of the particle dingsboom at the top of your code, it has an animate function that uses requestAnimationFrame to animate the particles. window.requestAnimationFrame will not work in most XR environment. It does work (surprisingly) when on desktop, but doesn’t work on the quest (as expected). Is there a way to force-animate (or step-forward) the particles?

Thanks for the quick replies. I’m not familiar with the particle code, since I took it from the BabylonJS examples for HtmlElementTexture. However, I created a simpler example below and confirmed that the HtmlElementTexture does work in VR, but you need to update the canvas properly, and window.requestAnimationFrame does not necessarily work in VR for updates.