Last active
May 15, 2019 02:41
-
-
Save Arthuralk/b971753454ee8916ecfe5b03b16a4fe2 to your computer and use it in GitHub Desktop.
MatCap for Godot, looks like blender matcap
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
//MatCap to Godot By ArthurAlk, Copy and Paste it in Fragment | |
//This shader looks like blender matcap | |
//Matcap texture | |
uniform texture MatCap; | |
//here the magic happens | |
vec2 vN = NORMAL.xy/2+vec2(0.5,0.5); | |
vN.y = vN.y*(-1)+1; | |
//This applies your MatCap to Model using the created UV | |
DIFFUSE = tex(MatCap,vN).rgb; |
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
//MatCap to Godot By ArthurAlk, Copy and Paste it in Vertex | |
uniform bool Fix_Back = true; | |
if (NORMAL.z<0 && Fix_Back) | |
{ | |
NORMAL.z = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment