npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hiwebgl-shadertoy-webgpu

v0.0.6

Published

A Shadertoy renderer using WebGPU

Downloads

2

Readme

Shadertoy-WebGPU

A Shadertoy renderer using WebGPU.

You can render a Shadertoy work only by passing its ID.

However if the author disallow to share his/her work via "public + api", you cannot render it in this library.

Install

npm i hiwebgl-shadertoy-webgpu

Guide


import { Shadertoy } from 'hiwebgl-shadertoy-webgpu';

// 1. Get a root element
const app = document.querySelector( '#app' );

// 2. Use static `Create()` method to get an instance
const shadertoy = await Shadertoy.Create( app );

// 3. Set input media if needed

// Set media url as iChannel0 for Buffer A.
// shadertoy.SetInputMedia( Shadertoy.RENDERPASS.BUFFER_A, 0, '/media/channel1.jpg'); 

// 4. Init work...
await shadertoy.InitShaderByID( 'Ns3XWf' );

// 5. Start rendering
shadertoy.Render();

Feature

  • [x] Uniforms - iResolution, iTime, iFrame, iChannelResolution, iMouse, iChannel0..3
  • [x] Only one Image buffer
  • [x] Multiple buffers - Commmon, Buffer A, Buffer B, Buffer C, Buffer D
  • [x] Texture as input media
  • [x] Sound as input media

TODO

  • Cubemap and cubemap buffer
  • More uniforms - iTimeDelta, iChannelTime, iDate, iSampleRate
  • More input media - video, keyboard, webcam, microphone, soundcloud...
  • More...

Dev

npm install

npm run dev

Known issue

  1. Not suport sampler2D as an independent variable in any form. Becasue WGSL doesn't support combined texture with sampler (for now), and GLSL spec disallow use them mixing together, see https://github.com/gpuweb/gpuweb/issues/770 and https://github.com/KhronosGroup/glslang/issues/2746#issuecomment-956192711

  2. Due to Shadertoy's CORS policy we cannot fetch input media (texture, music...) directly. So before calling InitShaderByID(), you should download it manually. When input media detected, a warning in your browser console should be thrown, just click the media's url, then next call SetInputMedia() to set media resources.