Last active
February 26, 2018 20:27
-
-
Save mahulst/cacdf340ce969f482c3507bd266f45b5 to your computer and use it in GitHub Desktop.
low poly vertex shader
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
| void main () { | |
| float y = calculateSurface(position.x, position.y); | |
| vec3 p1 = vec3(vert1.x, calculateSurface(vert1.x, vert1.y), vert1.y); | |
| vec3 p2 = vec3(vert2.x, calculateSurface(vert2.x, vert2.y), vert2.y); | |
| vec3 p3 = vec3(vert3.x, calculateSurface(vert3.x, vert3.y), vert3.y); | |
| vec3 normal = normalize(cross(p2 - p3, p1 - p2)); | |
| gl_Position = perspective * camera * vec4(vec3(position.x, y, position.y), 1.0); | |
| vcolor = normal; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment