Coder Social home page Coder Social logo

amandaghassaei / gpu-io Goto Github PK

View Code? Open in Web Editor NEW
1.2K 22.0 39.0 24.03 MB

A GPU-accelerated computing library for running physics simulations and other GPGPU computations in a web browser.

Home Page: https://apps.amandaghassaei.com/gpu-io/examples/

License: MIT License

TypeScript 56.72% JavaScript 42.29% HTML 0.19% CSS 0.81%
glsl gpgpu gpu webgl canvas shaders physics threejs shader particles

gpu-io's People

Contributors

amandaghassaei avatar ekzhang avatar setsun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpu-io's Issues

How to change Physarum background color?

Hello again Amanda,

I am trying to change the default black background color without success.

We can also refer to this example in the further code:
https://openprocessing.org/sketch/1760726

I tried to change the render fragment shader from this:

in vec2 v_uv;
uniform sampler2D u_trail;
uniform float u_scale;
out vec4 out_state;
void main() {
	out_state = vec4(texture(u_trail, v_uv).xyz * u_scale, 1);
}

To this:

in vec2 v_uv;
uniform sampler2D u_trail;
uniform float u_scale;
out vec4 out_state;
float luma(vec3 color) {
	return dot(color, vec3(0.299, 0.587, 0.114));
}
void main() {
	vec3 trailColor = texture(u_trail, v_uv).xyz * u_scale;
	float brightness = luma(trailColor );
	vec3 backgroundColor = vec3(1.0, 0.0, 0.0);
	vec3 mixedColor = mix(backgroundColor, trailColor , brightness);
	out_state = vec4(vec3(mixedColor), 1);
}

The result is almost there, but the mixedColor borders are not smooth.

Thank you once again,
Carlos

Reading framebuffer data to pixel buffers

Wondering if anyone has tried reading data from gpu-io framebuffers to a pixel buffer, and if so how did it go?

I'm considering trying this. I think it could potentially simplify the process of using data computed with gpu-io as regular old uniform buffer/vertex buffer data, as an alternative to transform feedback, and to extra texture sampling. That said, I'm unsure about performance, so will need to experiment.

If it works it'd be cool to have a little API for it, especially if it could be used with THREE.js buffers in the same way as the textures can be shared.

(by the way, this library is awesome, I tried like 5 different WebGL GPGPU libraries before settling on this one and it's been working out great)

Update GPULayers vars

Hi Amanda,

I am trying to update the array of colors attached to the GPULayer after initialization.

I am referring to your example available here:
https://openprocessing.org/sketch/1760726

I already tried to invoke other methods like:
particlesColor.setFromArray(colors);

But the values are not updated.

I also tried different combinations of invoking step method by the program.

Cheers,
Carlos

support for 3D textures

README.md file has a TODO note to add an example of working with 3D textures, it would be nice to have.

  • Show how to store 3D data in a 1D array.
  • Show how to work with the 3D texture in the shader, including how to access the texture data using 3D coordinates

Canvas clear

I am a little confused about when the canvas is cleared in a multi-step program. How does one disable canvas clearing, for instance?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.