Advertisement
Guest User

blender-camera-filter-glsl-cell-shading

a guest
Sep 2nd, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. uniform sampler2D bgl_RenderedTexture;
  2. uniform sampler2D bgl_DepthTexture;
  3.  
  4. void main()
  5. {
  6.     float depth = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy).r;
  7.     float depth2 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0.0, 0.003)).r;
  8.     float depth3 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0.003, 0.0)).r;
  9.  
  10.     float fac = abs(depth-depth2) + abs(depth-depth3);
  11.  
  12.     float intensity = 300.0;
  13.  
  14.     vec4 sub = vec4(fac*intensity, fac*intensity, fac*intensity, 0.0);
  15.     gl_FragColor = texture2D( bgl_RenderedTexture, gl_TexCoord[0].xy ) - sub;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement