The internet is a lawless place with knowledge and sarcastic wit the pistols of this wild frontier.
Don't go out without being sufficiently armed.


Other places

Ares (Current version: 0.B)

Ares's primary facilities have been moved elsewhere:

  • If you wish to report a bug in Ares, please proceed to its bugtracker.
  • If you'd like to request a feature, register a blueprint.
  • If you have questions or can provide answers regarding Ares's usage, visit the Q&A section.
  • Before you post a new question, you should check the FAQ, though.


  • Mind the forum rules.
  • Due to its documentedly horrible quality, we do not offer NPatch support.

Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About lighting
Author Message
Corporal pd Offline
The Man with the Shock Rifle
STX Hostees

Posts: 731
Joined: 24 Jan 2005
Reputation: 10
Post: #1
About lighting
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]
16.08.2006 21:02:16
Visit this user's website Find all posts by this user Quote this message in a reply
Corporal Bobingabout Offline
The Fucking DVD
Community Patrons

Posts: 1 571
Joined: 12 Feb 2005
Reputation: 4
Post: #2
RE: About lighting
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.

16.08.2006 21:29:44
Visit this user's website Find all posts by this user Quote this message in a reply
Commander-in-Chief Renegade Offline
Lazy Modder

Posts: 1 906
Joined: 21 Nov 2004
Reputation: 14
Post: #3
RE: About lighting

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.
16.08.2006 23:32:44
Visit this user's website Find all posts by this user Quote this message in a reply
Commander-in-Chief DCoder Offline
Not Ares Anymore

Posts: 1 756
Joined: 22 Nov 2004
Reputation: 18
Post: #4
RE: About lighting
Yes, there are about 1700 pages we need to update ... takes time and dedication.

Btw, covers that stuff in more detail.

17.08.2006 07:17:29
Visit this user's website Find all posts by this user Quote this message in a reply

No info available...
Post: #5
RE: About lighting
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.

struct Lighting {
    double level;
    double ambient;
    double red;
    double green;
    double blue;
    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 *   * (data[i+0]<<2)));
            unsigned char g = std::min(
                255, static_cast<int>(ambient * * (data[i+1]<<2)));
            unsigned char b = std::min(
                255, static_cast<int>(ambient *  * (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("isosno.pal"), L);
19.06.2008 01:06:40
Quote this message in a reply
Post Reply 

User(s) browsing this thread: 1 Guest(s)