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

  • February 21, 2013
  • 823 Downloads
  • 4 Likes
  • Blender 2.6x
  • Render: Blender Internal
  • Creator: BsDev
  • License: CC-BY
You must be logged in to download.

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

<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!

Comments:

  • prof-2004 profile picture
    prof-2004

    Hey... that nice.

    Thank you very much for sharing!

    ;)

    Written February 22, 2013
  • downshiftdx profile picture
    downshiftdx

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

    Written May 04, 2013
  • WIP profile picture
    WIP

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

    Written June 26, 2013
  • geav88 profile picture
    geav88

    Thank you for sharing

    Written October 07, 2013
  • atheistpally profile picture
    atheistpally

    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!

    Written October 08, 2013
  • BsDev profile picture
    BsDev

    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.

    Written October 23, 2013
  • cgbrown_mos profile picture
    cgbrown_mos

    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;

    }

    Edited November 07, 2013
  • BsDev profile picture
    BsDev

    Thanks for fixing that, appreciate your work

    Written January 17, 2014
  • Mirador profile picture
    Mirador

    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.

    Edited March 02, 2015
  • Zapor profile picture
    Zapor

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

    Written March 03, 2018