PHoRD

04-26-2001, 05:02 PM

Okay, so I'm not terribly experienced with openGL, but I've done some work. However, I *have* been reading articles on 3D graphics principles, etc. I've been planning to implement an idea in a sort of test run, but I was going to run the idea by the forum first. Here goes, please try to bear with me...

The most common (and hardware-friendly) method for cel-shading (cartoon-like shading/coloring) is to take E dot N and L dot N computations for each vertex, then assigning texture coordinates based on them. First off, L dot N is indexed into a 1D texture with 3 color shades for highlighted, medium, and shaded. A very low L dot N highlighted, and L dot N >90 is shaded. All else is medium.

Then a second pass is rendered, where a black and transparent 1D texture is referenced. For all vertices such that E dot N is near 90, the texture coordinates are on the black end. All other vertices are rendered clear. This produces an edge outline on top of a 3-color model.

Okay, now my idea-- wouldn't it be considerably faster to simply make a 2D texture that consists of the color texture (oriented horizontally) stretched vertically, with a bar of black on top? That way, in the y direction (for example) in the texture, one either references colors or black, and in the x direction, the colors vary. Then, simply generate the x texture coordinate via the L dot N calculation and the y coordinate via the E dot N calculation. Would this not produce a similar effect with only one pass? I'd appreciate it if you (the reader who managed to fight his way to the end of this long-winded explanation) could give me any insight you might have. Thanks a lot.

[This message has been edited by PHoRD (edited 04-26-2001).]

The most common (and hardware-friendly) method for cel-shading (cartoon-like shading/coloring) is to take E dot N and L dot N computations for each vertex, then assigning texture coordinates based on them. First off, L dot N is indexed into a 1D texture with 3 color shades for highlighted, medium, and shaded. A very low L dot N highlighted, and L dot N >90 is shaded. All else is medium.

Then a second pass is rendered, where a black and transparent 1D texture is referenced. For all vertices such that E dot N is near 90, the texture coordinates are on the black end. All other vertices are rendered clear. This produces an edge outline on top of a 3-color model.

Okay, now my idea-- wouldn't it be considerably faster to simply make a 2D texture that consists of the color texture (oriented horizontally) stretched vertically, with a bar of black on top? That way, in the y direction (for example) in the texture, one either references colors or black, and in the x direction, the colors vary. Then, simply generate the x texture coordinate via the L dot N calculation and the y coordinate via the E dot N calculation. Would this not produce a similar effect with only one pass? I'd appreciate it if you (the reader who managed to fight his way to the end of this long-winded explanation) could give me any insight you might have. Thanks a lot.

[This message has been edited by PHoRD (edited 04-26-2001).]