cel-shading (or cartoon-edges)

Started by dangerdoc, February 11, 2012, 19:31:25

Previous topic - Next topic

dangerdoc

I am trying to make a game, and have searched several hours about cel-shading, and cartoon edges, no results. Does anyone have any idea how to make cel-shading like this:


Please help! ???
dangerdoc
“We build but to tear down. Most of our work and resource is squandered. Our onward march is marked by devastation. Everywhere there is an appalling loss of time, effort and life. A cheerless view, but true.” - Nikola Tesla

Simon Felix

Quote from: dangerdoc on February 11, 2012, 19:31:25...and have searched several hours about cel-shading, and cartoon edges, no results. Does anyone have any idea how to make cel-shading

How on earth do you search?

The first link that comes up in Google for "cel-shading opengl" is a NeHe tutorial, which shows one way to do it:
http://nehe.gamedev.net/tutorial/cel_shading/25001/

Some other article:
http://www.cse.unr.edu/~mahsman/courses/cs791a/

Did you try that?
Download Cultris II, the fastest Tetris clone from http://gewaltig.net/

dangerdoc

Sorry, I guess I wasn't searching with the correct keywords. I have read one of those pages before, and I didn't understand how to port the second tutorial to java. I just need a simple outline for cubes, and models. I do not understand whether or not you use a shader, java file, or something else. I am stumped with this. I just need an example in lwjgl. Maybe I am missing something obvious, but I have given an honest effort to learn this.

Thanks,
dangerdoc
“We build but to tear down. Most of our work and resource is squandered. Our onward march is marked by devastation. Everywhere there is an appalling loss of time, effort and life. A cheerless view, but true.” - Nikola Tesla

matheus23

Uhmm... I think this topic is acctually too old. But for anyone, who is visiting this page, because he wonders how it is done (!I'm not sure!, but I think) its done like that:

At first, without GL_DEPTH_TEST being enabled, the whole "World" is rendered as a "Wireframe". That means:
glDisable(GL_DEPTH_TEST);
glLineWidth([about] 4f);
drawModel([mode:] GL_LINES);
glEnable(GL_DEPTH_TEST);


Now, as you have rendered the "World" as a Wireframe, you just "overwrite" it with the "real" World (omg: sooo much "'s :D).

Again, I'm not really sure if it is done like that, but I'm pretty sure it is. Just look at examples like blender. In blender you see an orange line around your objects in the "3D View". If you texture your object, and view it from the "back-side" (Where the Texture is getting "invisible" because it is the wrong face to show the Texture on (Culling)), you will see an orange Wireframe :).
And the second point why it may be made like that, is, that i'm pretty sure it would work like that :)
My github account and currently active project: https://github.com/matheus23/UniverseEngine

dangerdoc

Thanks for the help, (I am new, so I don't exactly know what to change, or where to put your code) but where do you put that? If you put it in a .shader, where do you put the shader? I understand some of the parts of LWJGL, but not shaders. I am struggling with cel-shading, and have spent a good amount of time searching for an understandable (by me) tutorial. I found some code, and other things, but I don't know where to put the code, how to change my source, or even the concept.

Thanks,
dangerdoc
“We build but to tear down. Most of our work and resource is squandered. Our onward march is marked by devastation. Everywhere there is an appalling loss of time, effort and life. A cheerless view, but true.” - Nikola Tesla

dangerdoc

Okay, I have been working at lWJGL, and now I have one final question...
Does this go in the init code or the loop?
“We build but to tear down. Most of our work and resource is squandered. Our onward march is marked by devastation. Everywhere there is an appalling loss of time, effort and life. A cheerless view, but true.” - Nikola Tesla