-
-
Notifications
You must be signed in to change notification settings - Fork 35.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
NodeMaterial: WebGPU #20421
NodeMaterial: WebGPU #20421
Conversation
@Mugen87 folow ( #20421 (comment) ) ( f738e6a ) |
I don't think it is necessary to make a new example for nodes anymore. Do you mind modifying the existing |
@Mugen87 You have any idea for that error message I am getting: |
This message did not pop up in my tests so far but I assume that /cc @Kangz @takahirox |
@mrdoob This PR looks really great! In context of design, I would highlight one important aspect since it will accompany node material from the very beginning. With the current implementation, nodes have the responsibility to control their build/generation. This process is mainly done with a node builder with is injected as a parameter. One could consider a different architecture such that nodes do not have any build/generate methods but just describe themselves. You then have a centralized entity that traverses through the node composition and performs the build. I personally favor the current approach since it's similar to having |
Mmmmh it should work with the std140 layout, but WebGPU seems to think it is 28 bytes probably because of a bad array stride? Could you share permalink of the GLSL->SPIRV compilation in http://shader-playground.timjones.io/ ? |
I don't know how to share a permalink. Here is some sample code:
It seems that even if a single float only takes 4 bytes, it's necessary to put 12 bytes as padding when starting with |
I guess we need the logic from the UBO PR that determines the total buffer size according to the STD140 layout. https://github.com/mrdoob/three.js/pull/15562/files#diff-cba50499b84f8d3f3690b625a907ba74R209 |
Ah yes, I misread. It is expect that the buffer would use 28 bytes in std140 layout because things are mostly padded to 16 bytes all the time. Like you said, the logic in the UBO PR should help. |
I made a texture animated to test, this |
@Mugen87 I move |
I suggest merge this PR while I doing the others, in case it's ok for you too. I update all WebGPU examples. |
I think that the next step is move |
That sounds good. The renderer should not manage/setup UBOs but the material system. I've initially added this code in |
I would say yes. The general structure of the node material system looks good to me. Merging this PR means we have something on |
@mrdoob Are you okay with merging this? 😊 |
Thanks! |
@Mugen87 @mrdoob Very, very draft to facilitate the understanding... this is a step implement to WebGL too, is my new approach, merger node slots directly in ShaderLib...
I fork the example
webgpu_sandbox.html
and added just some lines code: