shader-slang / slang

Making it easier to work with shaders
http://shader-slang.com
Other
3.07k stars 212 forks source link

[request] HTML5 example. #5656

Open 0wwafa opened 3 days ago

0wwafa commented 3 days ago

It would be great to have a simple example on how to load and apply a SLANG shader (for example a CRT emulation) to a DIV/CANVAS in HTML5.

aleino-nv commented 2 days ago

Unfortunately, at the moment we don't have a stand-alone example that does only what you ask and nothing else.

The one example we have is https://github.com/shader-slang/slang-playground.

It is, however, conceptually simple:

  1. Take Slang shader input from user
  2. Compile it to WebGPU shading language (WGSL)
  3. Use that just as you would in a normal WebGPU application.

A bit more details on the implementation: