Skip to content

Instantly share code, notes, and snippets.

@luruke
Created October 25, 2019 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luruke/7e3c639f5aa2b14626f18ef69b758c85 to your computer and use it in GitHub Desktop.
Save luruke/7e3c639f5aa2b14626f18ef69b758c85 to your computer and use it in GitHub Desktop.
this.plane = new PlaneBufferGeometry(1, 1, 1, 1);
this.viewerMaterial = new RawShaderMaterial({
blending: AdditiveBlending,
vertexShader: `
precision highp float;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
attribute vec2 uv;
attribute vec3 position;
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,
fragmentShader: `precision highp float;
uniform sampler2D uTexture;
uniform float uTime;
varying vec2 vUv;
void main() {
gl_FragColor = texture2D(uTexture, vUv);
gl_FragColor.a *= 0.07;
gl_FragColor.a *= 1.0 + ((sin(uTime * 0.3 + vUv.x * 14.0) + 1.0) / 2.0) * 2.0;
}
`,
transparent: true,
depthWrite: false,
uniforms: {
uTexture: { value: this.buffer.target },
uTime: { value: 0 },
},
});
this.viewer = new Mesh(this.plane, this.viewerMaterial);
this.add(this.viewer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment