WebGPU texture as threejs texture

Hello all,

I have been looking at the webgpu compute texture example and have been making some progress modifying the tsl Fn to get the texture on the plane to respond to some external inputs (e.g. the changing x,y position of a sphere for example).

My question is, if I want to write the compute shader part in WGSL rather than tsl how do I use the webgpu texture in the threejs material on the plane?

For reasons of responsiveness, I don’t want to read the webgpu texture back to the JS side, I’d just like to use the same webgpu texture in the threejs material so that as the webgpu texture is recomputed, it is immediately displayed as the material on the threejs plane.

I have been using threejs for a while now but I am new to textures and webgpu and I can’t work out if this is something that should be very straightforward or is more tricky.

Thanks for any pointers you can give me,

Nick

1 Like