Skip to content

Instantly share code, notes, and snippets.

@luruke
Created October 25, 2019 09:09
Show Gist options
  • Save luruke/4f44aa56c4f2451a048e90175a5ec0c9 to your computer and use it in GitHub Desktop.
Save luruke/4f44aa56c4f2451a048e90175a5ec0c9 to your computer and use it in GitHub Desktop.
// Buffer
this.buffer = new FBO({
geometry: this.geometry,
width: SIZE_BUFFER,
height: SIZE_BUFFER,
name: 'buffer particles',
shader: `
precision highp float;
uniform sampler2D texture;
uniform sampler2D uImage;
void main() {
vec2 uv = gl_FragCoord.xy / RESOLUTION.xy;
vec4 current = texture2D(texture, uv);
vec4 data = texture2D(uImage, uv);
current += data;
current.a *= 0.86;
gl_FragColor = current;
}
`,
uniforms: {
uImage: { value: this.rt.texture },
},
rtOptions: {
minFilter: LinearFilter,
magFilter: LinearFilter,
type: UnsignedByteType,
depthBuffer: true,
depthWrite: true,
depthTest: true,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment