Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Benadiba Laurent, posted on October 17, 2001




Image Description, by Benadiba Laurent



Here is a screenshot of my new cartoon rendering based engine ( k- Engine).

The engine currently features : Cartoon rendering, shader system with mesh deformation, multi - layers effect, texture animations, landscape ( with really low memory usage , and dynamic deformations ), skinning, animation, exports from MAX using FlexPorter, D3D8 TnL support, console, profile, debug, memory management systems, effects system ( particles, halos ), Anti Aliasing ...

The cartoon rendering, as you can see in the wireframe shots, use a fatter and black object precalculated at the load time and drawn with inverse backface culling.

This fat object contains only vertex buffer with the FVF XYZ ( without normals, and so on), so it is only 30 % more memory usage than using only the normal mesh.

The fat object is precalculated using the normal of each vertex, instead of an uniform scale wich does not give correct result for angles. The rendering is done using the ZBias function as mentionned before, to avoid Z Fighting, and can involve Anti Aliasing for nicer borders.

The shading is a two layers shader, with the texture and an environment mapped texture on it,

If you want to participate to the engine, just tell me, I like to work with other programmer !

Thanks !

Benadiba Laurent


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
anubis23

October 17, 2001, 01:57 PM

nice,
did you employ linux or are you just a fan of birds.. ;)

 
TheRain

October 17, 2001, 02:04 PM

^ was thinkin the same thing ;) Very cool though... very cool.

 
D3stY

October 17, 2001, 02:04 PM

yo..

really cool!
nice.. :)

 
lunatic

October 17, 2001, 02:14 PM

SWEET! Cartoon rendering rulez.

Any possibility of seeing an animation?

( Just an animation of them rotating around would answer a dozen questions... )

For example: ;)

I understand the usage of the fat object to generate a black outline of the character, but I don't see how you got the black line to fade away into the character...

I refer to the first character and the black line that goes around the beak -but does not go completely around the beak. That is how it should be done, but uh.... How did you do that?



-lunatic

P.S. Anyone got good links to some theory / code on cartoon rendering like the one here?

 
Ezra

October 17, 2001, 02:16 PM

Nice shot - I always like to see cartoon rendering done on characters that are meant to look cartoonish! Good work!

-Ezra

 
sagacity

October 17, 2001, 02:20 PM

Pretty cute, although I think you shouldn't use ZBias but instead adjust the 'near' clipplane of the camera. This will result in the same effect visually but it'll also work on cards which do not expose ZBias.

 
Dr.Mosh

October 17, 2001, 02:26 PM

Looks fantastic. really nice edges, like the fading lunatic mentions.
Models are really good, where they from?

 
Politik

October 17, 2001, 03:32 PM

"I understand the usage of the fat object to generate a black outline of the character, but I don't see how you got the black line to fade away into the character..."

I think its because he uses what he calls inverse-backface culling, which means that none of the polygons which face the camera are shown. So all the black you see are the backs of polygons. The reason it is strong around the nose and fades into the body is that the nose is curved so that as the fat shape goes under the nose and out of view, the backs of the fat shapes polygons come between us and the body. As you move away from that kind of nose shape this stops happening.

Thats not a good explanation, because without a whiteboard I am helpless :-)

 
Ghost Face Killa

October 17, 2001, 03:56 PM

Nice work man. I don't know why everyone is refering to this as cartoon rendering though. The real name for it is cell shading. Lunatic - There is theory of this on gamedev. http://www.gamedev.net/reference/programming/features/celshading. Then over at nehe's site http://nehe.gamedev.net there is the source and a tutorial on how to do this. http://nehe.gamedev.net/tutorials/lesson38.asp I plan on putting this in my engine, but when it comes time to make a game i dont plan on using it, cause my game will be serious. However, I think it is sweet...once again keep up the good work.

 
psykotic

October 17, 2001, 04:00 PM

Nice work man. I don't know why everyone is refering to this as cartoon rendering though. The real name for it is cell shading. Lunatic - There is theory of this on gamedev.

It's not cell shading, it's cel shading. Also, the term cartoon rendering is generally broader and encompasses cel shading. By the way, you just lost whatever credibility you had left by referring to a GDNet article =)

 
Arath

October 17, 2001, 04:02 PM

What a ugly cartoon effect ;-)

I hope you'll find a good programmer to help you to finish your game!

Good luck!

PS : Why not a open-source and free game?

 
n1c_V

October 17, 2001, 04:06 PM

Looks nice keep up the good work.

 
CyberVenom

October 17, 2001, 04:52 PM

Z-Buffering can be employed to show only parts the inverse culled fat mesh that exist in front of the skinny mesh; remeber that the skinny mesh is not simply superimposed in 2d onto the fat mesh, but in 3d. That means that even though the visible part of the fat mesh is a backface, it can still be in front of part of the skinny mesh, so it shows up. In most places, however, the skinny mesh occludes the fat mesh leaving only the edges showing kind of like a corona.

 
dan_g

October 17, 2001, 04:57 PM

ouch

 
psykotic

October 17, 2001, 05:01 PM

Z-Buffering can be employed to show only parts ...

Yeah but z-fighting can still take place because of lacking precision, especially in the distance. An alternate way of handling this (other than using a depth bias) would be to first render the skinny mesh into the stencil buffer and set the appropriate stencil function so that the fat mesh would not be drawn where the skinny mesh has already been rendered. This is probably less than ideal because not all graphics cards have stencil buffer support (though you only need a 1-bit stencil buffer for this).

 
Peter Mackay

October 17, 2001, 05:35 PM

This looks really cool, I've been looking at cel shading for a while, not done any though.

 
lunatic

October 17, 2001, 05:40 PM

I think its because he uses what he calls inverse-backface culling, which means that none of the polygons
which face the camera are shown. So all the black you see are the backs of polygons. The reason it is
strong around the nose and fades into the body is that the nose is curved so that as the fat shape goes
under the nose and out of view, the backs of the fat shapes polygons come between us and the body. As
you move away from that kind of nose shape this stops happening.

Your explanation is just fine.

I see it now.... very clever.

Now I see why just "scaling" the fat object would screw everything up....

How does this method look on rough angled objects ( a robot instead of a round bird )? I would guess the same....

-lunatic



 
CyberVenom

October 17, 2001, 05:44 PM

An alternate way of handling this (other than using a depth bias) would be to first render the skinny mesh into the stencil buffer and set the appropriate stencil function so that the fat mesh would not be drawn where the skinny mesh has already been rendered.

Unfortunately, stenciling like that would prevent the nice foreground lines visible in the skinny bird's beak & feet because that area would already be filled with the skinny mesh by the time the fat mesh is rendered.

Yeah but z-fighting can still take place because of lacking precision, especially in the distance.

Not much z-fighting would take place because the backfaces in the fat mesh would always be at least (fat_radius - skinny_radius) Z units behind the occluding skinny mesh. Remember that the fat mesh is outside the skinny mesh and does not intersect it. There is room enough to prevent z-fighting. Also, as the z-depth increases for a model, the fat-skinny difference can be increased, preventing Z-fighting in the distance, and preserving the hand-drawn look even far away by increasing the outline thickness in proportion to the apperent size of the model.

 
disableddan

October 17, 2001, 05:54 PM

Cool!

 
psykotic

October 17, 2001, 05:56 PM

Not much z-fighting would take place because the backfaces in the fat mesh would always be at least (fat_radius - skinny_radius) Z units behind the occluding skinny mesh. Remember that the fat mesh is outside the skinny mesh and does not intersect it. There is room enough to prevent z-fighting.

As you know, there is less z precision in the distance so it might become a problem. Increasing the difference might solve it but would probably introduce another problem: Objects that appear tiny because of their distance to their camera would have overly fat outlines. I guess you could just choose to not render the fat mesh when the distance crosses some threshold.

 
afk

October 17, 2001, 05:58 PM

Cool!

I always wondered what one of these would look like in a scene from Quake 3 or something. :-)

 
FireFoX

October 17, 2001, 06:15 PM

Are these models for a game 'Smack the bird on the head with a hammer'? They would fit in great!

I see them walking around as happy little birds, and then *BLAM*.

Looks nice!

 
CyberVenom

October 17, 2001, 06:30 PM

Objects that appear tiny because of their distance to their camera would have overly fat outlines.

In a hand-drawn cel, the pen cannot make lines infinitely small ad distance appreaches infinity, so having overly fat outlines in the distance would look like an artifact of hand drawn scenes, which as I percieve it is the intent here.

Also, for you who lack a white board, here is a diagram of what we are talking about:

 
Ghost Face Killa

October 17, 2001, 06:54 PM

Hey psykotic ever hear of a typo man? People can make them. And sorry to say, but GDnet has alot of good articles and information. Nehe is where i learned alot of OpenGL when i was starting, and i respect him and his site. As for GDnet as a whole, i respect their site also. What does it matter what site, as long as everyone's doing the same thing. Plus it is the only place where i knew of a "cel shading"(see i can type it right :)) tutorial or theory article.

 
Timothy Barnes

October 17, 2001, 06:57 PM

Holy crap. That looks realistically cartoony!

I actually thought this was going to be a 2D rendering engine of some sort then I noticed the 3D wireframe at the bottom. l33t stuff man.

 
lunatic

October 17, 2001, 07:42 PM

As you know, there is less z precision in the distance so it might become a problem. Increasing the
difference might solve it but would probably introduce another problem: Objects that appear tiny because
of their distance to their camera would have overly fat outlines. I guess you could just choose to not
render the fat mesh when the distance crosses some threshold.

Don't REAL cartoons suffer the same problem. You can only draw a pencil line so thin!

 
CyberVenom

October 17, 2001, 08:01 PM

Don't REAL cartoons suffer the same problem. You can only draw a pencil line so thin!


exactly.

 
Politik

October 17, 2001, 08:11 PM

Can anything be done to make the shading look more smooth, more like it was done with a pencil or something (without using any of those techniques that cant be done real time). Are there improvements, even if there are no perfect solutions?

 
CyberVenom

October 17, 2001, 08:19 PM

Can anything be done to make the shading look more smooth, more like it was done with a pencil or something

I think the blocky shading is intentional.
Smoother shading could be achieved by increasing the precision of the shading calculator (I think it is rounding off to create the paint-by-number effect here).
Running at a higher color resolution could help (I don't think that is an issue here).
You could use vertex shading on the polygons with the colors at the verticies rounded to the pain-by-number colors, creating softer edges - an effect I think would make the models look better without losing the hand-drawn effect.

 
CyberVenom

October 17, 2001, 09:02 PM

I just had another thought:

Z-fighting should always be resolved in favor of the skinny mesh to minimize Z-buffer artifacts. This could be accomplished by adding a small bias equal to the precision of the Z-buffer to the thin mesh so that it would never be incorrectly occluded by the fat mesh due to precision issues. (is that what you meant before, psykotic?) Some artifacts would still appear, but it would look better to have the skinny mesh win any disputes.

 
This thread contains 45 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.