Cel-shading!

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

shadez
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 3
Joined: Tue Feb 01, 2005 2:34 pm
Location: finland

Post by shadez »

Gyrovorbis, ah yeah never actually tried that pvr thingie, maybe now to try it, thanks for hint :)

oh yeah, keep on doing this kind of stuff, it's pretty nice to see new capacities revealed!
a128
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 2
Joined: Wed Feb 02, 2005 8:24 am

Post by a128 »

It's just an experiment for now.
It's still too slow to use in a game.
I've got a ton of optimizations to do, mostly to the outline drawing code.
It'll be a fun weekend!
the outline code is done with a second translucent layer?! so this eatzs a lot of the fillrate of the PVR ..maybe you can use the blending layer with PUNCHTHRU textures?!

sometime I think games like jet set radio makes their "cellshader" just with 3d models with "comic/cell shading" looking textures.


did you used KGL for your great demo?

are you having triangles or triangles strips" in you model? uses strips !
quarn
Dreamcast Developer
Dreamcast Developer
Posts: 9
Joined: Wed Feb 02, 2005 10:33 am

Post by quarn »

a128 wrote:the outline code is done with a second translucent layer?! so this eatzs a lot of the fillrate of the PVR ..maybe you can use the blending layer with PUNCHTHRU textures?!

sometime I think games like jet set radio makes their "cellshader" just with 3d models with "comic/cell shading" looking textures.
Umm.. why would he need to draw the outline in another layer than the opaque?

Also, could you please elaborate on that statement about jet set radio?

Shadez, you should definately switch to pvr. Expect a huge difference if you use it correctly. About drawing lines, here is some old code I posted recently about that
shadez
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 3
Joined: Tue Feb 01, 2005 2:34 pm
Location: finland

Post by shadez »

quarn, lines via polygons? ouch (speedwise) :)... well if that's the only choice, gotta live with it...

oh and nice to see other sceners around here
quarn
Dreamcast Developer
Dreamcast Developer
Posts: 9
Joined: Wed Feb 02, 2005 10:33 am

Post by quarn »

shadez wrote:quarn, lines via polygons? ouch (speedwise) :)... well if that's the only choice, gotta live with it...

oh and nice to see other sceners around here
The pvr2dc only supports trianglestrips, sprites and modifier volumes as primitives, so you have no choice if you don't want to write to the framebuffer yourself (which is, if you have not tested already, extremely slow =)).

I just registered here today, so if I will visit this forum frequently or not is yet to be decided.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Trust me, if you make the switch to the PVR, you'll never look back.

Quarn! Welcome to the forums! It's an honor to have you here!
a128
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 2
Joined: Wed Feb 02, 2005 8:24 am

Post by a128 »

quarn wrote:
Umm.. why would he need to draw the outline in another layer than the opaque?
hmm....I guess I did not read carefully the original OpenGL example ....but "blending" does not work with two opaque layers?!!!

or did I got somethink 100% wrong in the last 3 years of DC developing :?
quarn
Dreamcast Developer
Dreamcast Developer
Posts: 9
Joined: Wed Feb 02, 2005 10:33 am

Post by quarn »

a128 wrote:hmm....I guess I did not read carefully the original OpenGL example ....but "blending" does not work with two opaque layers?!!!
Correct, you can't blend between two opaque layers. And again where is the blending needed in this example?
BlackAura
Dreamcast Developer
Dreamcast Developer
Posts: 1
Joined: Tue Feb 15, 2005 1:08 am

Post by BlackAura »

quarn wrote:Correct, you can't blend between two opaque layers. And again where is the blending needed in this example?
Assuming it still uses the same general design as the OpenGL version, the cel shading itself uses blending. It's a cross between standard lighting, and lightmapping.

As with lightmapping, the lighting is applied in a second rendering pass, and blended on top of the unlit colour pass. In cel-shading, a 1D texture is used, which contains a number of distinct colour bands. At one end, you have near-black. At the other, you have white. In the middle you may have a band of grey.

You take the lighting value from your lighting code, and instead of using it as an intensity value, you use it as a texture coordinate. So a vertex that is supposed to be black has a texture coordinate that's somewhere in the near-black area. A vertex that's supposed to be full white has a texture coordinate that's at the other end of the texture. Intermediate values are spaced between.

The hardware then does standard texture mapping, interpolating the texture across the surface of each polygon. That gives you the kind of banded effect.

For outlining, I can think of two ways to do it. You can render the original shape again, rendering only back-facing polygons, and make it slightly larget than the original. That'll work fine for an all-around outline. The alternative is to actually draw lines, and the only way to do that on a Dreamcast is using triangle strips.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Sorry, to get off-topic, but I'd like to humbly welcome BA to the forums.
quarn
Dreamcast Developer
Dreamcast Developer
Posts: 9
Joined: Wed Feb 02, 2005 10:33 am

Post by quarn »

BlackAura, I am aware of how the cel shading is implemented, thankyouverymuch. The point is that the model in this example does not use a texture, and thus no blending is needed as the shading and colouring can be done in one single pass in the opaque list.

There are many ways to do outlineing. As you mention, scaleing the object and drawing the backfaces is one. Another is to move the object slightly towards the viewer and draw the backfaces. Yet another is to find all the silhouette edges in the object and draw them as lines. A silhouette edge is an edge between two polygons where one polygon is frontfacing and the other one is backfacing (think about it). And ofcourse, there are many techniques for speeding up the finding of these silhouette edges (instead of using the naive O(n) approach, where n is the number of edges to test).

Silhouette edges are also perfect for generating shadow volumes. :)
Post Reply