webGL to webGPU

I want to make the switch to webGPU, but it seems that apart from the shaders there isnt any difference with the previous way threeJS worked, or is there?

It depends on what you are doing.

There are some thing you can do with WebGPU that you can’t do with WebGL2, such a using NodeTextures and Compute Shaders.

With WebGPU, you can use TSL to create things much easier than with WebGL2. One of my favorites is the smoke generator (particle emitter) in the examples. In a few lines, they have created a program that was much more complex in WebGL2.

To displace vertices in WebGL2 you had to create a special “OnBeforeCompile”. In WebGPU, you accomplish the same thing with a simple statement.

Using most of these things will require some changes in syntax. For example to add color or a diffuse texture to a NodeMaterial, you use a colorNode command.

I switched to WebGPU more than a year ago and it has been a voyage of discovery.

2 Likes

As an addition to this, TSL can be compiled to both WGSL and GLSL as shown by switching the output in the TSL editor example

4 Likes