Open mathiajusth opened 4 years ago
👋 @mathiajusth! Native support for WebXR probably won't be possible for a while, since Elm doesn't provide access to navigator.xr
etc., and since it's not "just another HTML element" the way a WebGL scene is it would require a different kind of API. (And I think Elm is unlikely to support WebXR directly until it has much broader browser support.)
I think the most promising approach would be to have an option to render elm-3d-scene
to HTML using A-Frame elements instead of using WebGL directly - you'd need to include the A-Frame JS on your HTML page, but then we could exploit A-Frame's existing WebVR etc. support. I think this should be possible, but there may very well be some gotchas and it would probably take a fair bit of work. (A-Frame support would need to be part of elm-3d-scene
directly - you'd need access to internal data types that aren't accessible by third-party code.)
Thank you for the fast reply.
Native support for WebXR probably won't be possible for a while, since Elm doesn't provide access to navigator.xr etc
I am sad to heat that, but you gave me hope with the a-frame approach. I started to look into 3D rendering / VR just a few day ago and a-frame indeed looked like the best candidate to take advatage of if one wants a functional reactive approach. So I'll try to look into that a bit more.
Btw. love you library, the best entry-friendly 3D rendering tool I found! A little off-topic, but do you have any recommendation regarding VR with any functional programming language?
Thanks for the kind words! As for VR in functional programming languages, I think the best I can point you to is https://github.com/halfzebra/elm-aframe, which was an early stab at getting Elm and A-Frame to play well together. (I probably should have linked to that in my first reply!) If I recall correctly I think it largely worked (though I never played around with it myself), but for whatever reason development hasn't continued.
Be aware that A-frame mutates the Dom and doesn't play well with Elm's vdom. Last time I checked. See also https://github.com/halfzebra/elm-aframe/issues/35
Thanks for pointing that out @harmboschloo, that's really good to know! From looking through some of the linked issues it seem that the A-Frame maintainers have no interest in compatibility with Elm, so even if it could be somehow made to work now it's likely that more issues would occur in the future.
Any thoughts on what the best path forward would be if someone was interested in doing VR with elm-3d-scene
? Maybe something like some custom web components that would use WebXR internally? I don't expect to have much time myself to work on anything like this directly in the near future, but I'd be happy to answer questions/provide feedback etc. if someone else wanted to have a go.
It could actually be interesting if perhaps elm-3d-scene
provided a generic way to render to a DOM tree with custom node names, perhaps with a customizable node name for the top-level node. Then different people could try creating web components that implemented that standard node hierarchy, e.g.:
A fresh contender to rival A-Frame would be https://github.com/hmans/three-elements
Ah very cool @PixelPartner! Will be interesting to see how that library evolves...
I just started looking into WebXR but it just for everything but the rendering. Since this package uses WebGL, it should be possible to somehow get this rendering into WebXR. WebXR sort of gives you parameters and a place to render your WebGL.
My understanding of all this works is very shallow, so bear with me.
Hi @perty, happy to help explain the internals of elm-3d-scene
if you want to investigate how WebXR support might work - probably easiest to ping me on the Elm Slack with any detailed questions
Ok, got it and thanks @ianmackenzie . I am currently on a fork of a fork of elm-aframe. Had some none-elm experience with Aframe.
Do you think it is something that could / should be part of this package?