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

threeshaderhelper

v0.1.1

Published

A helper to quickly set up ThreeJS Shader Materials and uniform manipulation from text. Meant to mimic ShaderToy.

Downloads

5

Readme

THREEShaderHelper

This is a fairly straightforward utility for ThreeJS to create shader materials and apply any shaders from text with the ability to push uniform updates. It replicates a lot of functionality from ShaderToy, but we extended it to let us use arbitrary uniforms which can be generated from the shader text itself. We use it for biofeedback. It also includes its own audio decoder to get audio FFT data into the shader.

For now, see Sensorium in Brains@Play for a full demonstration, though it is using a raw version of this library baked right into the applet. Will create a standalone demo later.

More docs incoming for this powerful little tool, otherwise give the code a try and see the test function createRenderer which includes camera, GUI & orbit controls

From Sensorium biofeedback demo. Capture

Class methods



//Static functions
generateShaderGeometry(type,width,height,fragment,vertex);
generateShaderMaterial(fragment,vertex);
createMeshGeometry(type,width,height);
downsample(array,fitCount,scalar);
upsample(array,fitCount,scalar);

//also this.defaultVertex and this.defaultFragment have default shaders, the defaultFragment is fine to use universally until you want to do more optimization

//Class instance methods
addUniformSetting(name,defaultValue,type,callback,min,max,step);
addNewShaderMesh(fragment,vertex,type,width,height,uniformNaes,name,author);
setUniforms(uniforms);
setMeshGeometry(matidx,type);
setMeshRotation(matidx,anglex,angley,anglez);
resetMaterialUniforms(material,uniformNames);
updateMaterialUniforms(material,uniformNames,meshType);
updateAllMaterialUniforms();
setShaderFromText(matidx,fragmentShaderText,vertexShaderText,name,author);
swapShader(matidx,onchange);
setShader(matidx,name,vertexShader,fragmentShader,uniformNames,author);
setChannelTexture(channelNum,imageOrVideo,material);

//frontend stuff
generateGUI(uniformNames,material);
createRenderer(canvas);
destroyRenderer();