Cel-shading!
Moderator: PC Supremacists
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?!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!
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 !
Umm.. why would he need to draw the outline in another layer than the opaque?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.
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
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 =)).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
I just registered here today, so if I will visit this forum frequently or not is yet to be decided.
- Falco Girgis
- 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:
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.quarn wrote:Correct, you can't blend between two opaque layers. And again where is the blending needed in this example?
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.
- Falco Girgis
- 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:
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.
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.