Toon Shading Outlines - Cel-Shading [GLSL|Realtime|BGE]

Description

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 ;)

Logic Bricks Setup

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!

Comments (11)

P
prof-2004 about 13 years ago

Hey... that nice. Thank you very much for sharing! ;)

D
downshiftdx about 13 years ago

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."

W
WIP almost 13 years ago

It's precisely that i sought (what complicated the English language). Thanks for this good script !

G
geav88 over 12 years ago

Thank you for sharing

A
atheistpally over 12 years ago

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!

B
BsDev over 12 years ago

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.

C
cgbrown_mos over 12 years ago

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(fac*intensity,fac*intensity,fac*intensity,0.0); gl_FragColor = texture2D( bgl_RenderedTexture, gl_TexCoord[0].xy ) - sub; }

B
BsDev over 12 years ago

Thanks for fixing that, appreciate your work

M
Mirador about 11 years ago

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.

Z
Zapor about 8 years ago

It is REALLY avecome! No, really, this shader deserve be in standart build of Blender! Really fast and not add any polygones. Cool!

K
KainEden over 4 years ago

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.

Sign in to leave a comment.