Skip to content

Instantly share code, notes, and snippets.

@Arthuralk
Last active May 15, 2019 02:41
Show Gist options
  • Save Arthuralk/b971753454ee8916ecfe5b03b16a4fe2 to your computer and use it in GitHub Desktop.
Save Arthuralk/b971753454ee8916ecfe5b03b16a4fe2 to your computer and use it in GitHub Desktop.
MatCap for Godot, looks like blender matcap
//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;
//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