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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gpucomputationrender-three

v2.0.0

Published

GPUComputationRender module for Three.js with ES6 compatibility

Readme

GPUComputationRender (ES6)

Typescript definitions inside module

With yarn

    yarn add gpucomputationrender-three

Or with npm

    npm install --save gpucomputationrender-three

Example of usage

https://threejs.org/examples/?q=gpgpu#webgl_gpgpu_birds

I just rewrite module to Typescript

Edvinas pranka

@epranka

https://www.kodmina.lt

Original module author yomboprime https://github.com/yomboprime

GPUComputationRenderer, based on SimulationRenderer by zz85

The GPUComputationRenderer uses the concept of variables. These variables are RGBA float textures that hold 4 floats for each compute element (texel)

Each variable has a fragment shader that defines the computation made to obtain the variable in question.

You can use as many variables you need, and make dependencies so you can use textures of other variables in the shader (the sampler uniforms are added automatically) Most of the variables will need themselves as dependency.

The renderer has actually two render targets per variable, to make ping-pong. Textures from the current frame are used as inputs to render the textures of the next frame.

The render targets of the variables can be used as input textures for your visualization shaders.

Variable names should be valid identifiers and should not collide with THREE GLSL used identifiers.

A common approach could be to use 'texture' prefixing the variable name; i.e texturePosition, textureVelocity...

The size of the computation (sizeX * sizeY) is defined as 'resolution' automatically in the shader. For example:

#DEFINE resolution vec2( 1024.0, 1024.0 )


Basic use:

// Initialization...

// Create computation renderer

var gpuCompute = new GPUComputationRenderer( 1024, 1024, renderer );

// Create initial state float textures

var pos0 = gpuCompute.createTexture();

var vel0 = gpuCompute.createTexture();

// and fill in here the texture data...

// Add texture variables

var velVar = gpuCompute.addVariable( "textureVelocity", fragmentShaderVel, pos0 );

var posVar = gpuCompute.addVariable( "texturePosition", fragmentShaderPos, vel0 );

// Add variable dependencies

gpuCompute.setVariableDependencies( velVar, [ velVar, posVar ] );

gpuCompute.setVariableDependencies( posVar, [ velVar, posVar ] );

// Add custom uniforms

velVar.material.uniforms.time = { value: 0.0 };

// Check for completeness

var error = gpuCompute.init();

if ( error !== null ) {

 console.error( error );

}

// In each frame...

// Compute!

gpuCompute.compute();

// Update texture uniforms in your visualization materials with the gpu renderer output

myMaterial.uniforms.myTexture.value = gpuCompute.getCurrentRenderTarget( posVar ).texture;

// Do your rendering

renderer.render( myScene, myCamera );

Also, you can use utility functions to create ShaderMaterial and perform computations (rendering between textures)

Note that the shaders can have multiple input textures.

var myFilter1 = gpuCompute.createShaderMaterial( myFilterFragmentShader1, { theTexture: { value: null } } );

var myFilter2 = gpuCompute.createShaderMaterial( myFilterFragmentShader2, { theTexture: { value: null } } );

var inputTexture = gpuCompute.createTexture();

// Fill in here inputTexture...

myFilter1.uniforms.theTexture.value = inputTexture;

var myRenderTarget = gpuCompute.createRenderTarget();

myFilter2.uniforms.theTexture.value = myRenderTarget.texture;

var outputRenderTarget = gpuCompute.createRenderTarget();

// Now use the output texture where you want:

myMaterial.uniforms.map.value = outputRenderTarget.texture;

// And compute each frame, before rendering to screen:

gpuCompute.doRenderTarget( myFilter1, myRenderTarget );

gpuCompute.doRenderTarget( myFilter2, outputRenderTarget );