postprocessing icon indicating copy to clipboard operation
postprocessing copied to clipboard

XR support?

Open Bossieh opened this issue 3 years ago • 12 comments
trafficstars

Currently it seems XR is not supported, see related issue here: https://github.com/pmndrs/react-xr/issues/205

Are there plans to support XR in the future?

Bossieh avatar Nov 02 '22 10:11 Bossieh

I am interested in this topic. I am developing various XR features in React environments and I have the same question. Any suggestion about it?

DanielMartinezSebastian avatar Feb 16 '23 19:02 DanielMartinezSebastian

Right, postprocessing effects are currently not stereo-aware. XR support will be addressed when v7 is complete.

vanruesc avatar Mar 22 '23 20:03 vanruesc

three.js core has long needed fixes since implementing layers. See https://github.com/mrdoob/three.js/pull/26160 which does so and implements WebXR rendering for postprocessing and three.js.

CodyJasonBennett avatar Jun 18 '23 06:06 CodyJasonBennett

I've created a project example for a ported lens distortion. With/without the webxr three fix I get distortion for both cameras no issue with black rendering. But there is an issue showing the texture for some reason in xr. In the mixed reality simulator it shows doubled up like three's effect composer, its not rendering a texture with the emulator browser extension and polyfill and shows up distorting both cameras.

https://danrossi.github.io/three-lens-distortion/example/postprocessing.html

xr fix. https://danrossi.github.io/three-lens-distortion/example/postprocessing-xr.html

https://github.com/danrossi/three-lens-distortion/blob/main/src/glsl/lens-distortion.frag

danrossi avatar Jul 11 '23 18:07 danrossi

I've updated my examples and a non video texture one shows up with no rendering and black background also with the three xr fix sadly.

https://danrossi.github.io/three-lens-distortion/example/postprocessing.html https://danrossi.github.io/three-lens-distortion/example/postprocessing-video.html

danrossi avatar Jul 12 '23 09:07 danrossi

I've taken to task to migrate xr changes over to postprocessing with updated examples.

https://danrossi.github.io/three-lens-distortion/example/postprocessing.html https://danrossi.github.io/three-lens-distortion/example/postprocessing-video.html

Using these branches

https://github.com/CodyJasonBennett/three.js/tree/fix/offscreen-webxr https://github.com/danrossi/postprocessing/blob/main/src/passes/EffectPass.js#L578

It still not showing right in the webxr polyfill with overlayed cameras. But in mixed reality simulator it shows up correctly. not sure if the effect is being applied to each xr camera or the whole viewport.

danrossi avatar Jul 12 '23 14:07 danrossi

The effect is applied once to the whole viewport; the render pass should contain XR transforms. You can read from pose directly if you want to apply per-eye effects to keep it to 1 draw call -- it's notable that WebXR spec allows for any number of views which some devices have 6 or 100 of. Setting renderer.xr.enabled = false will opt out of XR transforms when rendering which all effects should be doing. I've already applied the necessary changes in https://codesandbox.io/s/kgjxfb which is waiting on https://github.com/mrdoob/three.js/pull/26160.

CodyJasonBennett avatar Jul 12 '23 15:07 CodyJasonBennett

Yes that works too. I'm sorry I don't understand how to modify the effect I made to do that so the distortion is applied to both cameras seperately. I've integrated your three changes into the tests. And updated RenderPass. I've only updated EffectPass.

https://github.com/danrossi/postprocessing/blob/main/src/passes/RenderPass.js#L322

Is those changes still needed ?

I've integrated the webxr fixes into these demos.

https://danrossi.github.io/postprocessing/public/demo/#bloom

danrossi avatar Jul 12 '23 16:07 danrossi

I've rebuilt everything and integrated webxr into the manual demos in this branch. But npm isn't liking checking out your branch of three with the fixes, the module has to be copied in. There is a possible bug with webxrmanager I have to figure out. I'll work out the issue with my effect so it's applied to both webxr cameras.

https://github.com/danrossi/postprocessing/tree/webxr-render-fix

danrossi avatar Jul 13 '23 19:07 danrossi

I've fully upgraded the manual and public demos with the fix merged with latest three in that branch. It seems to be working but can't get pages generated for it. fullscreen render.

Screenshot (91)

danrossi avatar Jul 14 '23 14:07 danrossi

Wondering what's the status.

Utopiah avatar Apr 10 '24 15:04 Utopiah

I spent too much time on it and gave up for now. It's waiting on integrating changes in three. I couldnt get the lens distortion showing up stereo its just monoscopic.

danrossi avatar Apr 11 '24 04:04 danrossi