This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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