Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About lighting
#1
I'm requesting some information about the lighting tags right now Tongue

What the hell are:
- Ambient
- AmbientChangeRate
- Ground
- Level
?

I firstly want to update my SW clone pages, secondly this is something ModEnc really should cover... I believe I'm not the only person not knowing what those values mean.
[Image: jsfml.png]
Reply
#2
i can't remember exactly, but they all do stuff.

gound i think is a yes/no tag, meaning at ground level

ambient and level are both tags that adjust brightness.

i can't remember excatly how they work, i used to just tweak values.
Reply
#3
http://www.modenc.renegadeprojects.com/Ambient
http://www.modenc.renegadeprojects.com/A...ChangeRate
http://www.modenc.renegadeprojects.com/Ground
http://www.modenc.renegadeprojects.com/Level

...I don't quite see your problem.
Forum Rules

(01.06.2011, 05:43:25)kenosis Wrote: Oh damn don't be disgraced again!

(25.06.2011, 20:42:59)Nighthawk Wrote: The proverbial bearded omni-bug may be dead, but the containment campaign is still being waged in the desert.
Reply
#4
Yes, there are about 1700 pages we need to update ... takes time and dedication.

Btw, http://www.cncgames.com/maps_tut_lights_rvmech.shtml covers that stuff in more detail.

Worth playing: 1 | 2 | 3
Reply
#5
I'm not sure what you've already gathered, but I can tell you this:

When rendering pallets, the game needs the map's lighting settings.
The values in the map are multiplied by the values in the palet files. Ambient is the number of brightness added per higher level (tiles that have higher z-index).

Here's some code that calculates the used palets from the lighting section.

Code:
struct Lighting {
    double level;
    double ambient;
    double red;
    double green;
    double blue;
    Lighting();
    Lighting(const INI_Section& ini);
    void Read(const INI_Section& ini);
};

void Palet::Initialize(shared_ptr<File> f, const Lighting& l, bool greyscale) {
    // Level is the ammount of "more white" that is gained by highening tiles
    // Ambient is the overall ammount of light/darkness
    // Red, green and blue define alterations in respective colors

    // Initialize palet from file
    vector<unsigned char> data;
    f->read(data, 768);

    // load greyscales if needed
    if (greyscale)
        memcpy(&data[16*3], greyscales, 16 * 3);

    double ambient = l.ambient;

    // Add colors for 15 heights, each time adding level to ambient
    for (int j = 0; j < 15; j++) {
        // Three bytes per color, 256 colors
        for (int i = 0; i < 768; i += 3) {

            // shift 2 bits, only first 6 are used
            // don't go over 255, that'd look weird :D
            unsigned char r = std::min(
                255, static_cast<int>(ambient * l.red   * (data[i+0]<<2)));
            unsigned char g = std::min(
                255, static_cast<int>(ambient * l.green * (data[i+1]<<2)));
            unsigned char b = std::min(
                255, static_cast<int>(ambient * l.blue  * (data[i+2]<<2)));

            // Stored as int, although only first 24 bits are going to be used
            // Alignment required anyway
            colors.push_back(b + 256 * g + 65536 * r);
        }
        ambient += l.level;
    }
}

// returns pointer to a modified palet, can be used to draw SHP/TMP
// images with some adjusted form of light
int* Palet::Get_Colors(int Height) {
    return &colors[0] + 256 * Height;
}



Lighting L(myMap.Get_INI_Section("Lighting"));
Palet p_iso;
p_iso.Initialize(vfs.open("isosno.pal"), L);
Reply




Users browsing this thread: 1 Guest(s)