cel shading lines

Started by
11 comments, last by Panzooka 19 years, 6 months ago
Quote:Original post by JohnBolton
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.
Surely you can just move vertices along their normals, instead of simply 'enlarging' the model? Though that does require fully welded meshes, I guess.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Advertisement
So far I've seen three basic methods for outlines:

- Draw backfaces in wireframe, with outline colour. Dead easy but does weird popping of edges as the model rotates. Not really a good idea.

- Enlarge the model along the normals, then draw backfaces with outline colour. Simple (and fast) in a vertex shader. Works with pretty much any geometry, and doesn't have any weird artifacts as it moves. Dead easy to control the outline size as a constant to the vertex shader as well.

- Image space methods that involve doing edge detection. Great quality, but needs lots of fillrate and fancy shaders.

Second one is probably your best bet (as already suggested). If you want custom outline colours I'd create a second texture for it (yet use the same uvs as the original skin, then you don't need any extra vertex data). If you want to get really fancy you could have a per-vertex attribute that would specify the outline size and let the vertex shader use that while scaling the vertices.

I'm inclined to say that any methods that involve CPU work (like running silluette detection) aren't a good idea since you can just use the same vertex data and a vertex shader. Of course you might already be calculating silluette data (Jet Set Radio uses shadow volumes for example, which gives great clean cut toon style lighting).
wirefram is ugly, because i dont want to draw line in front, and u cant control that in wirefram mode.

i guess the polygon backface method is the best.

This topic is closed to new replies.

Advertisement