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

  • February 21, 2013
  • 931 Downloads
  • 5 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
  • KainEden profile picture
    KainEden

    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.

    Written October 16, 2021
  • etghnbsgxdcgb profile picture
    etghnbsgxdcgb

    Absolutely loving this post! It's incredible how it highlights the importance of 먹튀검증 self-care in our daily lives. I've recently discovered that incorporating 먹튀검증 mindfulness practices can really make a difference. The way you explained 먹튀검증 stress management techniques is so relatable. I also appreciate the mention of 먹튀검증 healthy habits, which are essential for overall well-being. Your insights into 먹튀검증 work-life balance resonate with me. It's so true that we need to prioritize 먹튀검증 mental health alongside our busy schedules. Thanks for sharing such valuable tips! I’ll definitely be trying out the 먹튀검증 community resources you suggested. Keep the great content coming! 먹튀검증 inspiration.

    Written March 19, 2025
  • kuehekkeheuk profile picture
    kuehekkeheuk

    Wow, this post is truly amazing! I love how you incorporated different elements that resonate with so many of us. It's so important to share insights like these, as they can 바카라 노하우 inspire and uplift others. I particularly appreciate the way you highlighted key points that often get overlooked. Your perspective is refreshing, and I think it can really 바카라 노하우 spark meaningful conversations. If only more people would take the time to consider these aspects, we could see a 바카라 노하우 shift in understanding. Let's keep pushing for positive change and awareness! Thank you for sharing this, as it certainly makes a difference. Can't wait to see what you come up with next! 바카라 노하우 Keep up the fantastic work! 바카라 노하우 Sharing posts like these helps build a community that is both informed and engaged. It’s all about learning together! 바카라 노하우 Here's to more discussions that matter! 바카라 노하우

    Written March 21, 2025