Game Development Community

TLK & Cel Shading

by DavidRM · in Torque Game Engine · 04/27/2006 (8:41 pm) · 4 replies

(Re-post from the General forum; didn't even see this forum; oops)

I integrated TLK with my current project, for which I'm also doing cel shading.

My question is: How do I "turn down" the brightness on models that I'm not lighting with OpenGL? For cel shading, I expect to disable OpenGL's lighting and handle the lighting/shading myself.

A bit more background: The initial results were dreadful. The cel shaded player model and weapon were overexposed, whited out to pale imitations of themselves.

After some tweaking (and reading the PDF modelers guide) I got the mission map looking passable, but didn't seem to be having any impact on the player model. That one stayed overexposed. Even if I applied a darker cel shading texture, all I got was a darker version of the overexposed ick-ness.

I did eventually get the player to look much as he had before I installed TLK. Here's how:

I enabled OpenGL lighting again on the model render.

That's the opposite of what I had to do to get cel shading working *before* TLK. I *think* it's because OpenGL puts your model at "full bright" when you turn off lighting. Under normal Torque, that means you get the colors as they look in the texture image (no subtractive lighting). Under TLK...that seems to mean you get the double-bright-overexposed-washed-out colors.

Even with the reduced lighting in the mission, TLK is so bright that almost no shading is visible on the model. If I weren't cel shading, you would hardly see any shading at all.

So...what I want to know is: How do I "turn down" the brightness in TLK? Is that even possible?

Am I just doing something TLK didn't anticipate?

Am I even making sense? =)

Thanks!

-David

#1
04/28/2006 (1:46 pm)
Hi David,

The easiest way to remove the overexposure from DTS objects is to open sgNewMethods.cc and on line 290 (in sgTSMesh::sgInitMaterials) change the following:

glTexEnvf(GL_TEXTURE_ENV,GL_RGB_SCALE_EXT, [b]SG_LIGHTING_OVERBRIGHT_AMOUNT[/b]);

To:

glTexEnvf(GL_TEXTURE_ENV,GL_RGB_SCALE_EXT, [b]SG_LIGHTING_NORMAL_AMOUNT[/b]);

This removes overexposure on all DTS object and should also remove it from DTS self-illuminated surfaces.

-John
#2
04/28/2006 (2:16 pm)
Thanks, John!

-David
#3
05/01/2006 (6:15 pm)
Hi David,

Did this work correctly for you?
#4
05/01/2006 (7:57 pm)
Yah, it worked as advertised. Thanks! =)

-David