funnyplanter / CuNNy

Convolutional upscaling Neural Network, yeah!
GNU Lesser General Public License v3.0
62 stars 3 forks source link

Any thoughts on porting shaders to WebGL / WebGPU for web-based viewers? #4

Open kvnxiao opened 1 week ago

kvnxiao commented 1 week ago

Had thoughts of working on a web-based application for reading manga and thought this would be a great way to up the quality of old sources. Of course, this would require using WebGL / WebGPU.

funnyplanter commented 1 week ago

Yes this seems like a cool idea. The main problem I have right now (even with the current repo) is that it will be annoying and probably quite bloatful to generate all the possible permutations of shaders for each backend every time I update/add new models. What I'm thinking right now is that I'll use free time next month to work the shader generation into a github.io page using something like Pyodide. Then I would only pre-generate the mpv(/dp4a)/Magpie shaders onto the repo, but I'll upload the raw model files as well which would be able to work with the webapp generator. This will complete #5 as well.

kvnxiao commented 6 days ago

Awesome, I'm afraid I can't help too much here since I'm not familiar with writing shader code, but I think the next step would be to investigate how to use the .glsl shaders in a web context via WebGL or WebGPU.

There is, for example, this reference https://github.com/Anime4KWebBoost/Anime4K-WebGPU for using Anime4K with WebGPU - and likely the approach would be very similar here as well.


I know there are a few tools online that can help convert glsl shader code to wgsl which WebGPU uses, for example this discussion from https://github.com/gfx-rs/wgpu/discussions/1812#discussioncomment-1196560 -- but not sure how relevant or helpful it will be here