Skip to content

Instantly share code, notes, and snippets.

@h3r
Created May 23, 2020 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h3r/f16ab7ea5ebaec193e5a874e7c5d1f75 to your computer and use it in GitHub Desktop.
Save h3r/f16ab7ea5ebaec193e5a874e7c5d1f75 to your computer and use it in GitHub Desktop.
GLSL Matcap funcs
vec4 matcap(sampler2D sampler, mat4 view_matrix, vec3 normal, float scale){
vec3 vN = (view_matrix * vec4(normal, 0.)).xyz;
float2 uvs = view_N.xy * vec2(1.,-1.) * 0.48 * scale + vec2(.5, .5);
return texture2D(sampler, uvs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment