Created
February 2, 2022 21:06
-
-
Save supahfunk/02ccfc5fc08d40bbada88b1cf8fe43b5 to your computer and use it in GitHub Desktop.
Matcap material glsl
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
/* Vertex shader */ | |
vNormal = normalize(vec3(world * vec4(normal, 0.0))); // Normal in model | |
/* Fragment shader */ | |
// Move normal to view space | |
highp vec2 muv = vec2(view * vec4(normalize(vNormal), 0))*0.5+vec2(0.5,0.5); | |
// read texture inverting Y value | |
gl_FragColor = texture2D(matcapTexture, vec2(muv.x, 1.0-muv.y)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment