Game Development Community

Cell Shading

by Martin Edmaier · in Torque Game Engine · 01/15/2002 (10:15 am) · 16 replies

Hy to all.

Is there a way to creat a Cell Shading style for the torque Engine System? Or is there a script for this graphic style available? Pleaz reply

Martin Edmaier

#1
01/15/2002 (10:17 am)
Nope, no cel shading as yet, its on my todo list.


Phil.
#2
01/15/2002 (8:09 pm)
BUMP

Im curious about cell shading as well.

Are you one of the developers Phil ? Or are u trying to do it for your game as well ?

Any ETA on perhaps when cell shading will be implemented ? Its sumthing i desperately wanna use.

Are there in depth articles on how cell shading works ? for exmaple how it renders textures e.t.c ?

Would love to learn more about it.

Possibly even modify the renderer myself to do it (though i have no idea where to start)

Regards
#3
01/15/2002 (9:05 pm)
There's a brief article on GameDev.net here.
#4
01/25/2002 (3:10 am)
Hy,
I will try to add cel shading for shape object in the torque engine. We have a nice discussion on our team, and it seems that we need this for our game.
BTW, I will be pleased if you have any hints / tips on the rendering structure/process of shape object in torque. I'm already digging into the tsMesh class, but any help will be welcome.
#5
01/25/2002 (3:13 am)
There are many ways to do the cel shading effect, unfortunately its hard to find a way thats fast, works on D3D and OGL and looks good in all circumstances.

Ive got about 7 methods to try out, so one of those will be the one to choose.

As regards an ETA on the code, might be a month or so still, got a lot of other work on my schedule before cel shading.

And btw, no, I'm not part of GG.com, I'm doing this for my own game, but will submit the code to GG for inclusion in the engine.

Phil.
#6
01/25/2002 (3:38 am)
Method that I will try is a one without vertex shader as it is not supported on Torque. I will start working on it next week.
#7
01/28/2002 (11:02 am)
Here are some preliminary results of my implementation of cell-shading into Torque.
Without cell shading :
perso.wanadoo.fr/hysteria/DoP/images/cell5.jpgWith cell shading :
perso.wanadoo.fr/hysteria/DoP/images/cell4.jpgIt is really in alpha state as it is still a bit slow and there are few bugs concerning the shading. I will try to optimize it and to solve all my problems but some of them are getting me mad ;)
#8
01/28/2002 (11:06 am)
Frank, turn off the lighting glDisable(GL_LIGHTING) as its not required and will slow things down a little.

What else is wrong?

What method are you using btw? as there are quite a few ways to do it, some methods are slower than others.

Phil.
#9
01/29/2002 (11:57 pm)
Thx for the GL_LIGHTNING things
The few bugs are :
- does not work with directx on my laptop (renderVB)
- gradient shades and not flap shades
- not elegant integration inside torque renderer ;)

The slowdown is mainly due to my algo :
- compute for each vertices : n.light (n: normal, light: light direction)
- use it to set the vertices color to a gray shade
(n<0.2 gray=0.3, n>0.2 gray=1)
- set all the vertex, color, texture arrays
- draw front facing model
- draw outline backfacing model

that's all folks.

I'm trying to find a faster way to set the shades, and even use some multitexturing things...need to dig a little bit more...

Phil, if you have any info please contact me

Frank / sage-team@wanadoo.fr
#10
01/30/2002 (12:28 am)
I've seen projects use a 1D texture for flat shading before.
#11
01/30/2002 (3:42 am)
Yeah, 1D textures are a good way to get a decent shade.

Frank: there are sooo many ways of doing this, ranging from simple and fast but with problems, so slow and correct.

I'll have to take a stab at a few to figure out whats best for torque.

The easiest one I ever saw was to draw the model front faces first (no lighting or texture), the draw the backfaces of the model again, but slightly pushed forward and in black (so the zbuffer made a sort of black halo round the character). It was a bit pants in that it was really dependant on Zbuffer resolution and only acted like a halo :))

Take a look at Sim Deitrich's cel shading methods for OpenGL.

Take a look at this link:

http://www.red3d.com/cwr/npr/

Thats got almost every possible rendering style known to man on there. :))

Phil.
#12
01/30/2002 (4:43 am)
>The easiest one I ever saw was to draw the model front faces first

That's the method Frank is using I believe, they use the same methon in copla of cartoon games out there, cel damage, etc...
#13
01/30/2002 (6:38 am)
Yep, you're right Gema it is what I did exactly but when I draw the model backface, i do not fill it and I set the line witdh to be bold, so it outlines quite well the model. But it does not work for the shade.

For the shade, the only issue is a fast way to compute the u,v coordinates of the 1D texture (or the gray vertex color).
#14
01/30/2002 (6:42 am)
BTW, the website proposed in reference is very interesting Phil. thx
#15
01/30/2002 (7:35 am)
Frank what is 1D texture? It's first time I hear of this :)
#16
01/30/2002 (7:49 am)
A 1D texture has only one dimension. It's basically a row of pixels, as opposed to a standard 2D texture or legendary 3D texture.