5
\$\begingroup\$

I use blender game engine, and blender use openGL for graphics. How can I draw lines around all 3D objects? Would this be a job for a filter? Mainly, I want my end result to look drawn.

I found this:

 uniform sampler2D bgl_RenderedTexture;
uniform sampler2D bgl_DepthTexture;


void main()
{
   float depth = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy).r;
   float depth2 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0,0.002)).r;
   float depth3 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0.002,0)).r;

   float fac = abs(depth-depth2) + abs(depth-depth3);

   float intensity = 9050;  


   vec4 sub = vec4(fac*intensity,fac*intensity,fac*intensity,0);

   gl_FragColor = texture2D( bgl_RenderedTexture, gl_TexCoord[0].xy ) - sub;
}



#change float intensity

here and that seems to work, but i need it to look more sketched. So some noise influence. maybe it's called sinus displacement? Is there a way to do that?

I draw, and i wanted the style to look like this. Thanks.

Disclaimer: I do hang out on BSE and this is not a question they are prepared to answer or is it necessarily on-topic for them, since it is about openGL.

\$\endgroup\$
  • \$\begingroup\$ What you want to Google is "NPR Shaders". \$\endgroup\$ – Yousef Amar Dec 10 '15 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.