cel shading lines

Started by
11 comments, last by Panzooka 19 years, 6 months ago
ok i know the concept of cel shading and the lines around it, but the line doesnt look smooth when the model is low poly and line is thick. now i recently saw that they made counter strike models cel shaded look without alter the game engine. basicly, it just have a black outline on models. so i downloaded the models, milkshape it, and found out how its done. for example we create a cube in 3d. color it say in blue duplicate the cube, make it slightly bigger, and color it in black, reverse all faces for the black cube. know ingame, u cant see back of the faces, so u see throug the black cube. u will see the blue cube, and the other half of the black cube which is slightly bigger than the blue cube, and thus looks like a black outline. i think this method produces nice looking lines that are drawn by black polygons and easy to implement. this also allow much more controls over the lines, u can have different color lines for different model parts, (say u can have brown outlines for face, and black outlines for clothes) easiy to control the thickness, u can even have thiner lines for eyes/lips, and thicker lines for guns. the downside of this method is that it doubles the polycount for the model. but it shouldnt be because most back faces are ignored. drawing lines in classic cel shading method is slow too. so what u guys think? does this method will eventualy replace the method we currently use to draw lines?
Advertisement
The backface method's main problem is that it will only do the outer lines and leave any inner lines undefined.

As for different colours of lines you can do that in either method quite easily.
it does outline the inner lines, try it in your 3d software
Actually "this" method was the first method. That's exactly how Jet Set Radio (Jet Grind Radio in USA) - supposedly the first game to ever use cellshading - was done.

It is a good trick, but having the black outlines saved along the model have the drawback of creating twice the polygons to store and load (like anyone cares - most PC games are using whooping 3GB of HD space anyway). The major advantage is that you can store the outline colors with the model texture, and have the outline faces's UV point to a single point in the texture. That way you could draw the whole model with a single call, with a little of care.

You could also generate the outline mesh at runtime. That way you could change the thickness depending on the distance.
Medion: Wouldn't having a seperate vertex shader* be better, since you could skip having ANY textures and just use flat shaded colours?

*Output position would be the input position extended across the normal by some constant, output colour is some constant and output normal is the input normal. The benefits would be: no texture lookups or texture rasterization, only one model with no extra vertices, and the outline can have a flexible width (AND a flexible colour!). Plus, since it would have to be in a seperate render call, you can change the cull mode to remove forward facing ones (saving you one quick calc to reverse the normal).

Hmm...this thinking has me a bit interested in doing it as an experiment...
Hmm, nice ideas, really. Maybe it would also be possible to batch all models (since there'll be no textures, color and line width info could be stored at vertex-level anyway) and render them using a single call. The con is that vertex-shader-based skinning probably would work well with batching.
Quote:Original post by Cypher19
Medion: Wouldn't having a seperate vertex shader* be better, since you could skip having ANY textures and just use flat shaded colours?

*Output position would be the input position extended across the normal by some constant, output colour is some constant and output normal is the input normal. The benefits would be: no texture lookups or texture rasterization, only one model with no extra vertices, and the outline can have a flexible width (AND a flexible colour!). Plus, since it would have to be in a seperate render call, you can change the cull mode to remove forward facing ones (saving you one quick calc to reverse the normal).

Hmm...this thinking has me a bit interested in doing it as an experiment...


very nice, cypher, rated u

also, if its a single call, how to disable lightning and other effect on that black model. so i will go with seperate call, that should speeds the rendering process up
One problem is that it only works for convex models. A doughnut will not render correctly (because the hole gets bigger, not smaller), for example.

It is not easy to draw outlines that look good in every case. Look up "non-photorealistic rendering" to find out about the many different techniques for drawing outlines. The best I've come across is Philippe Decaudin's technique: Cartoon-Looking Rendering of 3D-Scenes.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
concave model works too mate (just need few tweaks when enlarging the original model)

i like how the terrain looks in Philippe Decaudin's technique, but it also draws "front lines"

the method i used is draw a line on edge where 2 faces meet but one of the face is facing away from view.

edit: the enlarging method that works is:
duplacate the model, select all faces, and move alone normals
Quote:how to disable lightning and other effect on that black model.


Because the cel-outline is being done with a seperate render call, and therefore a seperate effect, things like lighting and other effects will be defined by you. I found out (the hard way...) that if you have an effect going on, regular fixed function stuff such as vertex lighting does not occur, and you have to basically reinvent the wheel (thankfully it's not too hard to do)

This topic is closed to new replies.

Advertisement