Skip to content

Instantly share code, notes, and snippets.

@dghez
Created October 7, 2022 21:27
Show Gist options
  • Save dghez/980f98fe6a56d34cccd07913de69fb4f to your computer and use it in GitHub Desktop.
Save dghez/980f98fe6a56d34cccd07913de69fb4f to your computer and use it in GitHub Desktop.
Fullscreen quad on threejs
this.geometry = new BufferGeometry()
const vertices = new Float32Array([
-1.0, -1.0,
3.0, -1.0,
-1.0, 3.0,
])
const uvs = new Float32Array([0, 0, 2, 0, 0, 2])
this.geometry.setAttribute('uv', new BufferAttribute(uvs, 2))
this.geometry.setAttribute('position', new BufferAttribute(vertices, 2))
this.material = new ShaderMaterial({
vertexShader,
fragmentShader,
uniforms: {
....
},
})
// VERTEX
void main() {
gl_Position = vec4(position.xy, 1.0, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment