Skip to content
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

Examples: Added webgpu_nodes_loader_materialx #24958

Closed
wants to merge 2 commits into from
Closed

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Nov 15, 2022

Description

Trying to add the WebGPU version of webgl_nodes_loader_materialx.

@sunag I guess the WebGPURenderer path is still missing some things?

Screen Shot 2022-11-15 at 4 55 14 PM

@mrdoob mrdoob added this to the r147 milestone Nov 15, 2022
@LeviPesin
Copy link
Contributor

LeviPesin commented Nov 15, 2022

The problem is that you use a GLSL version of MaterialX nodes (the official version), not a node (i.e. language-independent) version (there is not one yet). GLSL cannot work with WebGPU.

@mrdoob
Copy link
Owner Author

mrdoob commented Nov 15, 2022

Oh! D'oh!

Hmm... We should be better at error messages though...

@sunag
Copy link
Collaborator

sunag commented Nov 16, 2022

I was thinking of make a transpiler from GLSL to WGSL or ShaderNode. I think this would also save a lot of future work.
Does that make sense to you?

@mrdoob
Copy link
Owner Author

mrdoob commented Nov 16, 2022

A on-the-fly transpiler or offline?

@sunag
Copy link
Collaborator

sunag commented Nov 16, 2022

Both I imagined, although offline seems more appropriate for performance.

For API something like this:

const decoder = new GLSLDecoder();
const encoder = new WGSLEncoder();
//const encoder = new ShaderNodeEncoder();

const transpiler = new Transpiler( decoder, encoder );

const wgslCode = transpiler.parse( 'glsl source code' );

@mrdoob
Copy link
Owner Author

mrdoob commented Nov 17, 2022

Sounds good to me!

@mrdoob mrdoob modified the milestones: r147, r??? Nov 17, 2022
@sunag sunag mentioned this pull request Nov 19, 2022
3 tasks
@Hoodgail
Copy link
Contributor

Hoodgail commented Dec 9, 2022

@sunag
I had it in my mind as well. I recently created a simple typescript to GLSL transpiler, but I'll explore how difficult it would be to create a simple GLSL to WGSL transpiler.

@LeviPesin
Copy link
Contributor

I think a transpiler from GLSL to ShaderNode would be even better and more future-proof...

@Hoodgail
Copy link
Contributor

@LeviPesin Explain why that would be better than simply glsl to wgsl

@LeviPesin
Copy link
Contributor

Because ShaderNodes can be compiled to both GLSL and WGSL.

@Hoodgail
Copy link
Contributor

Because ShaderNodes can be compiled to both GLSL and WGSL.

Ohh!? Didn't know, because I was about to give up, WGSL's syntax is so complex, I might as well learn rust if I'm gonna learn that

@sunag sunag mentioned this pull request Oct 16, 2023
26 tasks
@sunag sunag mentioned this pull request Dec 2, 2023
@sunag sunag closed this in #27294 Dec 7, 2023
@mrdoob mrdoob deleted the webgpu-materialx branch December 7, 2023 23:54
@mrdoob mrdoob removed this from the r??? milestone Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants