gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Toon shading with glColor [SOLVED]

#149986 - Ultima2876 - Mon Jan 28, 2008 12:47 pm

Is it possible to have a coloured pyramid (like in the nehe examples) that is toon shaded without making it only one colour?

Code:
glSetToonTableRange(0, 7, RGB15(6,6,6));
glSetToonTableRange(8, 15, RGB15(12,12,12));
glSetToonTableRange(16, 23, RGB15(18,18,18));
glSetToonTableRange(24, 31, RGB15(24,24,24));


When the red component of the colour is used to look up the value within the toon shading table, in the above example my pyramid always comes out in shades of grey. Is there a way to make it have its original colours, but... toon shaded?

Is the way this is usually done to redefine the toon table for every polygon you want to have a different colour? Or is there another way?

Thanks


Last edited by Ultima2876 on Mon Jan 28, 2008 4:34 pm; edited 1 time in total

#149990 - M3d10n - Mon Jan 28, 2008 4:29 pm

You sort of answered the question yourself: the intensity of the red component from the vertex color is used to index the colors from the toon table, so you can't combine your vertex colors with the toon table colors.

But you can combine the toon table colors with the texture colors, so you could use a small texture with a solid color for each triangle. You could even use a 8x8 texture with a unique color in each pixel and adjust the texture coordinates of each triangle to use a different color.

#149991 - Ultima2876 - Mon Jan 28, 2008 4:34 pm

Aha, thanks very much.