Created
May 7, 2023 09:28
-
-
Save mbritton/118bb985f6c47ec5a09bf7fa390dc8a5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import * as THREE from 'three'; | |
const gradientMaterial: THREE.ShaderMaterial = new THREE.ShaderMaterial({ | |
uniforms: { | |
color1: { | |
value: new THREE.Color(0xffffff), | |
}, | |
color2: { | |
value: new THREE.Color(0xf4f4f4), | |
}, | |
}, | |
vertexShader: ` | |
varying vec2 vUv; | |
void main() { | |
vUv = uv; | |
gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); | |
} | |
`, | |
fragmentShader: ` | |
uniform vec3 color1; | |
uniform vec3 color2; | |
varying vec2 vUv; | |
void main() { | |
gl_FragColor = vec4(mix(color1, color2, vUv.y), 1.0); | |
} | |
`, | |
wireframe: false, | |
}); | |
export default gradientMaterial; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment