Skip to content

Instantly share code, notes, and snippets.

@michaelperros
Forked from eriksachse/material.js
Created August 25, 2024 02:57
Show Gist options
  • Save michaelperros/ad03a8a6cae574fad3a1fb9c97d23796 to your computer and use it in GitHub Desktop.
Save michaelperros/ad03a8a6cae574fad3a1fb9c97d23796 to your computer and use it in GitHub Desktop.
const WaveShaderMaterial = shaderMaterial(
// uniforms
{ uTime: 0, uTexture: new THREE.Texture() },
// vertex
glsl'
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
',
// fragment
glsl'
precision mediump float;
uniform float uTime;
uniform sampler2D uTexture;
varying vec2 vUv;
void main() {
vec3 texture = texture2D(uTexture, vUv).rgb;
gl_FragColor = vec4(texture, 1.0);
}
'
)
extend({ WaveShaderMaterial })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment