CfgWorlds: Lighting

The lighting and weather sections are a bit of a mystery as I don't think BI has ever officially documented them. Some comments on the forums suggest that it is not possible to change lighting on a per-map basis, and this probably goes for weather as well. Check these threads for more information:
Regardless, every config usually contains the line "class Lighting : DefaultLighting", which inherits default lighting settings. To me this says that it should be possible to set lighting per-map if you only overrode the Lighting class and left DefaultLighting alone, but I'm not that knowledgeable about the workings of BIS' configs.

Both Chernarus and Takistan inherit from DefaultLighting but then change the groundReflection[] array to the same values on both islands:

  class Lighting: DefaultLighting
  {
   groundReflection[] = {0.06,0.06,0.03};
  };


This is followed by two classes with rather confusing names, DayLightingBrightAlmost and DayLightingRainy. I'm not clear on what "BrightAlmost" is about, but I would expect that the first class defines default lighting and the second defines lighting during rain. What exactly these arrays of arrays inside the classes define isn't immediately obvious, though.

 
class DayLightingBrightAlmost: DayLightingBrightAlmost
  {
   deepNight[] = {-15,
    { 0.05,0.05,0.06 },
    { 0.001,0.001,0.002 },
    { 0.02,0.02,0.05 },
    { 0.003,0.003,0.003 },
    { 0.0001,0.0001,0.0002 },
    { 0.0001,0.0001,0.0002 },0};
   fullNight[] = {-5,
    { 0.05,0.05,0.05 },
    { 0.02,0.02,0.02 },
    { 0.04,0.04,0.04 },
    { 0.04,0.04,0.04 },
    { 0.01,0.01,0.02 },
    { 0.08,0.06,0.06 },0};
   sunMoon[] = {-3.75,
    { 0.045,0.04,0.04 },
    { 0.04,0.04,0.04 },
    { 0.045,0.04,0.04 },
    { 0.04,0.04,0.04 },
    { 0.04,0.035,0.04 },
    { 0.1,0.08,0.09 },0.5};
   earlySun[] = {-2.5,
    { 0.12,0.1,0.1 },
    { 0.08,0.06,0.07 },
    { 0.12,0.1,0.1 },
    { 0.08,0.06,0.07 },
    { 0.08,0.07,0.08 },
    { 0.1,0.1,0.12 },1};
   sunrise[] = {0,
    {
     { 0.7,0.45,0.45 },"5.16+(-4)" },
    {
     { 0.07,0.09,0.12 },"4.0+(-4)" },
    {
     { 0.6,0.47,0.25 },"4.66+(-4)" },
    {
     { 0.1,0.09,0.1 },"4.3+(-4)" },
    {
     { 0.5,0.4,0.4 },"6.49+(-4)" },
    {
     { 0.88,0.51,0.24 },"8.39+(-4)" },1};
   earlyMorning[] = {3,
    {
     { 0.65,0.55,0.55 },"6.04+(-4)" },
    {
     { 0.08,0.09,0.11 },"4.5+(-4)" },
    {
     { 0.55,0.47,0.25 },"5.54+(-4)" },
    {
     { 0.1,0.09,0.1 },"5.02+(-4)" },
    {
     { 0.5,0.4,0.4 },"7.05+(-4)" },
    {
     { 0.88,0.51,0.24 },"8.88+(-4)" },1};
   midMorning[] = {8,
    {
     { 0.98,0.85,0.8 },"8.37+(-4)" },
    {
     { 0.08,0.09,0.11 },"6.42+(-4)" },
    {
     { 0.87,0.47,0.25 },"7.87+(-4)" },
    {
     { 0.09,0.09,0.1 },"6.89+(-4)" },
    {
     { 0.5,0.4,0.4 },"8.9+(-4)" },
    {
     { 0.88,0.51,0.24 },"10.88+(-4)" },1};
   morning[] = {16,
    {
     { 1,1,0.9 },"13.17+(-4)" },
    {
     { 0.17,0.18,0.19 },"10.26+(-4)" },
    {
     { 1,1,0.9 },"12.67+(-4)" },
    {
     { 0.17,0.18,0.19 },"11.71+(-4)" },
    {
     { 0.15,0.15,0.15 },"12.42+(-4)" },
    {
     { 0.17,0.17,0.15 },"14.42+(-4)" },1};
   noon[] = {45,
    {
     { 1,1,1 },"17+(-4)" },
    {
     { 1,1.3,1.55 },"13.5+(-4)" },
    {
     { 1,1,1 },"15+(-4)" },
    {
     { 0.36,0.37,0.38 },"13.5+(-4)" },
    {
     { 1,1,1 },"16+(-4)" },
    {
     { 1.0,1.0,1 },"17+(-4)" },1};
  };
  class DayLightingRainy: DayLightingRainy
  {
   deepNight[] = {-15,
    { 0.0034,0.0034,0.004 },
    { 0.003,0.003,0.003 },
    { 0.0034,0.0034,0.004 },
    { 0.003,0.003,0.003 },
    { 0.001,0.001,0.002 },
    { 0.001,0.001,0.002 },0};
   fullNight[] = {-5,
    { 0.023,0.023,0.023 },
    { 0.02,0.02,0.02 },
    { 0.023,0.023,0.023 },
    { 0.02,0.02,0.02 },
    { 0.01,0.01,0.02 },
    { 0.08,0.06,0.06 },0};
   sunMoon[] = {-3.75,
    { 0.04,0.04,0.05 },
    { 0.04,0.04,0.05 },
    { 0.04,0.04,0.05 },
    { 0.04,0.04,0.05 },
    { 0.04,0.035,0.04 },
    { 0.11,0.08,0.09 },0.5};
   earlySun[] = {-2.5,
    { 0.0689,0.0689,0.0804 },
    { 0.06,0.06,0.07 },
    { 0.0689,0.0689,0.0804 },
    { 0.06,0.06,0.07 },
    { 0.08,0.07,0.08 },
    { 0.14,0.1,0.12 },0.5};
   earlyMorning[] = {0,
    {
     { 1,1,1 },"(-4)+3.95" },
    {
     { 1,1,1 },"(-4)+3.0" },
    {
     { 1,1,1 },"(-4)+3.95" },
    {
     { 1,1,1 },"(-4)+3.0" },
    {
     { 1,1,1 },"(-4)+4" },
    {
     { 1,1,1 },"(-4)+5.5" },1};
   morning[] = {5,
    {
     { 1,1,1 },"(-4)+5.7" },
    {
     { 1,1,1 },"(-4)+4.5" },
    {
     { 1,1,1 },"(-4)+5.7" },
    {
     { 1,1,1 },"(-4)+4.5" },
    {
     { 1,1,1 },"(-4)+7" },
    {
     { 1,1,1 },"(-4)+8" },1};
   lateMorning[] = {25,
    {
     { 1,1,1 },"(-4)+10.45" },
    {
     { 1,1,1 },"(-4)+9.75" },
    {
     { 1,1,1 },"(-4)+10.45" },
    {
     { 1,1,1 },"(-4)+9.75" },
    {
     { 1,1,1 },"(-4)+12" },
    {
     { 1,1,1 },"(-4)+12.75" },1};
   noon[] = {70,
    {
     { 1,1,1 },"(-4)+12.5" },
    {
     { 1,1,1 },"(-4)+11" },
    {
     { 1,1,1 },"(-4)+12" },
    {
     { 1,1,1 },"(-4)+11" },
    {
     { 1,1,1 },"(-4)+13.5" },
    {
     { 1,1,1 },"(-4)+14" },1};
  };


Fortunately, the second thread linked above clears up the meaning of some values, thanks to the efforts of Symbiot. I am simply repeating his findings here:

earlySun[] =

{
    -2.5,


    { 0.12,0.1,0.1 },

    { 0.08,0.06,0.07 },

    { 0.12,0.1,0.1 },

    { 0.08,0.06,0.07 },

    { 0.08,0.07,0.08 },

    { 0.1,0.1,0.12 },

    1
};


The first number in each array is the global light intensity.

The first RGB triplet is the color of the global light.

The second RGB triplet is the color of the ambient light.

Third and four triplets are unknown.

The fifth RGB triplet is the color of haze and fog.

The sixth RGB triplet is the color of the sun's halo.

Note that the groups for the times of day when the sun is up have the arrays in the following form:

{
    { 0.7,0.45,0.45 },
    "5.16+(-4)"
}

That is, an array of the RGB triplet plus a string containing a formula. The formula is the HDR force of that lighting component.

Symbiot did not speculate on the function of the last value in each array (which goes from 0 to 1), but since all the nighttime states have it as 0, the sunMoon state has 0.5, and all daytime states have 1, I am guessing it defines how close to "day" or "night" that lighting state is, or just the overall brightness (note also that the global light intensity is actually negative for the nighttime states, and the zero point is actually early morning).
Comments