Last active
January 8, 2017 17:06
-
-
Save marcosbitetti/29563e142f0c01b2fa27 to your computer and use it in GitHub Desktop.
MatCap shader prototype for Godot
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 | |
VAR1 = vec4(normalize(MODELVIEW_MATRIX * VERTEX), 1.0); | |
// Fragment | |
uniform texture matcap; | |
vec3 r = reflect(VAR1.xyz, NORMAL); | |
float m = 2.0 * sqrt( pow( r.x, 2.0 ) + pow( r.y, 2.0 ) + pow( r.z + 1.0, 2.0 ) ); | |
vec2 vN = r.xy / m; | |
vN += vec2(0.5); | |
DIFFUSE = tex(matcap,vN).rgb; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I made a different matcap shader, this shader uses only fragment and looks like blender matcap
Matcap.glsl