Hey Guys, so here's something new:
A shader, which creates some nice looking Outlines for your cartoon games.
This Shader takes nearly no power, so it's quite useful with even big games.
Remember to credit us, if you use this code. Thanks!
To save Computing Energy, use my Logic ;)
<img style="vertical-align: top; border: 10px solid black;" src="http://img3.fotos-hochladen.net/uploads/shadernodeset23c8yx4ukr.png" alt="Logic Bricks Setup" width="1106" height="388" />
To get the Materials right, select both at specular and diffuse the Toon-Option.
Diffuse: Set Intesity to 1,0; Size to 1,2; Smooth, whatever you want.
Specular: Intesity to 0,2; Size to 0,45; Smooth doesn't matter.
Set the Emit Value to around 0,1 and 0.05.
Have Fun!
I'd like to check this out but it isn't working for me. I'm on 2.66 on OS X. It looks like the screen shot of the logic brick setup is from a different version than the one uploaded... Small differences like the shader script just being called "Shader" rather than "Toon Shader."
It's precisely that i sought (what complicated the English language). Thanks for this good script !
This isn't working for me either on OS X Blender 2.66. I have the logic elements set up the same, with the exception of the script name (which is just called "Shader" in the uploaded version), but there is no outline when I hit P. I would love some help with this please!
Pay Attention to the Logic, it is mot likely the case, that you set up the Property false. I made this in another way before, you can try it. I used, instead of the property, a Always BRick to bring up the Shader. The Shader itself works fine. If this doesn't work, it's caused by OS X.
GLSL on Mac OS tends to be strict. If you declare a float you must assign a float. There are a few instances where the author declared float, but assigned an integer.
This is the correct code for the shader:
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, 0.002)).r;
float depth3 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0.002, 0.0)).r;
float fac = abs(depth-depth2) + abs(depth-depth3);
float intensity = 300.0;
vec4 sub = vec4(facintensity,facintensity,fac*intensity,0.0);
gl_FragColor = texture2D( bgl_RenderedTexture, gl_TexCoord[0].xy ) - sub;
}
Hi, I'm noob and sorry for bother you guys, but I couldn't use this. I tried a test with a new file, so I copied and pasted the shader script to this new file and ran it... but didn't work. Could you please explain what I'm doing wrong? Sorry for my english too, and thanks for the help.
It is REALLY avecome! No, really, this shader deserve be in standart build of Blender! Really fast and not add any polygones. Cool!
Hi. I had some ugly results on UPBGE 2.79.7. Smoothed faces looked edgy, but could be fixed by turning down the float intensity inside the script in line12. Hope this helps anybody with same results. Thanks for this script.
Hey... that nice.
Thank you very much for sharing!
;)