Game Development Community

70/30 intensity

by Jaimi McEntire · in Torque Game Engine · 10/27/2005 (7:40 am) · 1 replies

Quote:
Instead I can show you how to setup TLK to get the 70/30 of ambient/diffuse and still adjust the intensity to the scene's lighting.

Since Rama may or may not be posting, Just thought I would since I'm interested in this as well.

Jaimi

#1
10/27/2005 (12:10 pm)
Sure thing, here's a quick example of how to do it. First change the following lines of code in TLK...

In sgSceneObject.cc lines 188 and 245 replace:

const F32 directionalFactor = 0.3f;
         const F32 ambientFactor = 0.7f;

with:

const F32 directionalFactor = sgDynamicDTSShadingDiffuseAmount;
         const F32 ambientFactor = 1.0f - sgDynamicDTSShadingDiffuseAmount;


And at the top of sgSceneObject.cc add:

F32 sgDynamicDTSShadingDiffuseAmount = 0.3;


Now you can adjust sgDynamicDTSShadingDiffuseAmount to the percentage of the lighting that should be diffuse. As an example for the following sgDynamicDTSShadingDiffuseAmount values the percentages of the lighting is shown:

value    diffuse    ambient
----------------------------------------------
0.0      0%         100%
0.2      20%        80%
0.5      50%        50%
0.75     75%        25%
1.0      100%       0%


You probably noticed that the default value is 0.3 which provides the 70/30 you're looking for. This was already the default in TLK, but now you can tweak the values for the perfect lighting. :)

-John