-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Add support for WebGPURenderer and TSL example #5655
base: master
Are you sure you want to change the base?
Conversation
src/core/a-node.js
Outdated
@@ -15,7 +15,7 @@ export var knownTags = { | |||
}; | |||
|
|||
function isNode (node) { | |||
return node.tagName.toLowerCase() in knownTags || node.isNode; | |||
return node.tagName.toLowerCase() in knownTags || node.isAframeNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should def understand what's going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The infinite loop was here https://github.com/mrdoob/three.js/blob/a5734130516db50c1de2cdfe27f477a33ecd1c87/src/nodes/core/Node.js#L640-L648
I don't know much about the new node system to say what that code is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in #5363 (comment) my guess is that in aframe we set a reference to the entity with el on a three object.
Doing a search I get the following places:
$ ag "\.el = " src/
src/core/system.js
31: this.el = sceneEl;
src/core/component.js
66: this.el = el;
src/core/a-entity.js
36: this.object3D.el = this;
111: this.object3D.el = null;
140: obj.el = this;
143: child.el = self;
src/components/material.js
112: shaderInstance.el = this.el;
src/components/light.js
205: this.light.el = el;
src/components/text.js
437: shaderObject.el = el;
My guess is that the one set on shaderInstance.el
is the culprit and end up in the shader/material being build, but not sure how, I'm not familiar with the new webgpu code path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of any community components that is using an isNode check, I think it's fine to rename it to isANode and add a note about it in the release notes.
Cool. I would postpone this to 1.8.0. I will be cool to have a WebGPU path. |
http://127.0.0.1:8080/docs/basic-scene/ http://127.0.0.1:8080/showcase/curved-mockups/ |
http://127.0.0.1:8080/boilerplate/hello-world/ WebGPURenderer (webgpu backend or webgl2 fallback with r173) |
for me the only question is, what is the usecase for renderer.xr.setPoseTarget i never need this and its only used at aframe/src/core/scene/a-scene.js Line 553 in b9e4838
|
@dmarcos I think we could add a TSL example and then merge this, all the changes here are backward compatible with the WebGLRenderer aframe umd build. We can then make other changes if needed, mainly the text component that is completely broken by replacing it with troika-text if that one work with WebGPU backend. As of three r173, VR mode is not working with WebGPU, we get the error: |
Good question, we have that patch supermedium/three.js@3bfa95d (in 0.173.4 branch) |
@arpu In Three.js the |
So I guess we will need to do a similar patch to XRManager (used by WebGPU backend) to implement setPoseTarget when VR will be supported. |
There is an alternative which I use in my fork, namely disabling XR camera updates in Three.js and doing it ourselves in the |
Correct. That method or similar existed in WebVRManager and WebXRManager and was removed at some point. Since the pose applies only to the camera and one cannot apply it to an arbitrary Object3D. I raised the concern to THREE but was ignored. |
How do you disable camera updates? |
By setting Basically the above flag is an all-or-nothing and in an ideal world the part that transfers the WebXR pose onto the camera is done in the But I have no idea if the |
Thanks. I like the idea of having more control of the lower level parts that concern XR. So in your case the pose used for rendering is not the most current one since it’s done in the component? |
Description:
For those that want to play with WebGPURenderer and TSL.
Run
Start from
https://localhost:8080/showcase/tsl/
and port an example from https://threejs.org/examples/?q=tsl
Changes proposed:
start:webgpu
command that will import from three/webgpu instead of three via a webpack aliasAll the changes here are backward compatible with the default WebGLRenderer umd aframe build.
You can use WebGPURenderer in two ways:
via an importmap defining
three
andthree/webpgu
to usethree.webgpu.js
instead ofthree.module.js
in your webpack project defining the correct alias:
and using in
package.json
this PR for now:Using WebGPURenderer with classic aframe umd build is not supported, we don't generate a build for that.