Cel Shader

This is a discussion on Cel Shader within the Game Programming forums, part of the General Programming Boards category; I'm using the Crystalspace 3d engine and was wondering how you could create a shader that has no ambient light.(Like ...

  1. #1
    Registered User taelmx's Avatar
    Join Date
    Oct 2006
    Location
    Japan
    Posts
    55

    Cel Shader

    I'm using the Crystalspace 3d engine and was wondering how you could create a shader that has no ambient light.(Like "Zelda: The Windwaker") The engine uses XML files to handle shaders. I'm lost at where to start. The documentation barely covers it:

    http://www.crystalspace3d.org/docs/o...68.html#SEC418

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Cell shading is about limiting the amount of colors. We used to have 2 colors, 4 colors, 16 colors, 256 colors, 16 bit color, and now 32-bit color and higher.

    To do toon shading or cell shading you need to create a shader that can find the outlines of the objects and enhance those outlines. Then you can shade based on a 1D texture that limits the amount of color variation between various colors. By using simply u,v calculations you can effectively shade just as a cartoon would.

    It's actually quite simple and even moreso if you don't have to have the silhoutte enhanced. So you draw your 3D model just the same and you simply shade it differently.

    For an example of what takes place fire up your favorite 32-bit color game and take a screenshot. Now go to your fav photo editor and reduce the number of colors in the image and turn dithering off. What you end up with is the same image but with less colors, yet you can still see most of the details. Hence - cartoon shading.

  3. #3
    Registered User taelmx's Avatar
    Join Date
    Oct 2006
    Location
    Japan
    Posts
    55
    I'm going for this look:
    http://www.goodgame.se/upload/gamegu...l-shading1.jpg
    http://hometown.aol.com/folinator/zelda06.jpg

    Also, reducing the colors to 2, would make the image monochrome. I still want the color, but I want to make only 2 different types for how the shadows are cast:

    1. There is a shadow, thus the surface covered is darker. (not completely black)

    2. There is not a shadow, leave the surface alone.
    Last edited by taelmx; 11-14-2006 at 11:29 PM.

  4. #4
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    You may want to have a look at the "Gooch" shader from the orange book.
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  5. #5
    Registered User taelmx's Avatar
    Join Date
    Oct 2006
    Location
    Japan
    Posts
    55
    That looks like a pretty good site. However, the gooch shader only does the dark outlines, which I will not be usiing in my game. This is more of a gradient shader with edge enhancement. http://3dshaders.com/shaders/Gooch.jpg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Shaders and parameters
    By VirtualAce in forum Game Programming
    Replies: 2
    Last Post: 12-06-2006, 06:33 AM
  2. Shader hell
    By VirtualAce in forum Game Programming
    Replies: 4
    Last Post: 08-18-2006, 09:21 PM
  3. Replies: 6
    Last Post: 11-12-2005, 10:57 AM
  4. Phong Pixel Shader for PS1.3
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 08-27-2005, 10:05 PM
  5. tank track vertex shader
    By reanimated in forum Game Programming
    Replies: 4
    Last Post: 03-20-2004, 01:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21