gainmap-js icon indicating copy to clipboard operation
gainmap-js copied to clipboard

Support for WebGPU Renderer

Open Makio64 opened this issue 1 year ago • 3 comments

In r167 we now use import from 'three/webgpu'

It breaks @monogrid/gainmap-js with the error : WARNING: Multiple instances of Three.js being imported.

What will be the best workaround ?

Makio64 avatar Jul 29 '24 06:07 Makio64

Hi! unfortunately the decoder has only been developed with the WebGL Renderer in mind (it decoded in the GPU thanks to a custom shader).

WebGPU support has not started yet: the way you made it work for now is "don't pass the renderer parameter" which forces the library to create its own disposable WebGL Renderer but now it seems three.js is detecting a duplicate renderer.

I'll need to write a custom shader for the WebGPU Renderer in order to support this, I'll see when I'll be able to do that soon. Thanks for reporting

daniele-pelagatti avatar Jul 29 '24 07:07 daniele-pelagatti

@daniele-pelagatti Hello, can we now support web GPU renderer?

WREQI avatar Mar 10 '25 05:03 WREQI

wish I could vibe code my way into helping this effort

seantai avatar Mar 29 '25 13:03 seantai

I am also interested in this. It would be very helpful to use it with WebGPU.

samevision avatar Sep 28 '25 21:09 samevision

Sorry this is a bit late, it has been a very busy year and a half.

#72 has been merged and adds WebGPU support for decoding gain maps through the @monogrid/gainmap-js/webgpu entry point.

It includes WebGPU implementations of decode, GainMapLoader, and HDRJPGLoader using Three.js TSL (this means it has automatic WebGL2 Fallback).

Hope it works for you guys.

Sooner or later I'll make this the default (when threejs makes the WebGPU renderer the default)

daniele-pelagatti avatar Nov 17 '25 15:11 daniele-pelagatti