We open a series of articles on working with lighting. Without that, the world will seem less alive, right? 3 articles are planned. If necessary, then I will make animated previews and re-issue, but in the meantime, as usual, we download the map and run it in the editor.
So, the first issue is the lighting on which the classic Doom is based, so it should be as productive as possible, but will require more sectors and more painstaking drawing in cases if we want to achieve maximum detail. As far as it is possible with the Doom 1/2/64.
Here and further we will consider the sectors-sections of the map, signed with drawn red numbers and containing examples. The paragraph in the article corresponds to the sector with this figure.
The most primitive parameter is the brightness of the sector. In three-dimensional navigation mode, it can be changed by aiming at the sector, pressing Ctrl and twisting the wheel. Affects everything at once: the degree of illumination of textures in the sector, actors in it and… all. The sky, if any, is not affected in any way. The example shows how, by changing the brightness of the sectors, we created a dark cave and the entrance to it, which gradually ceases to pass photons. Simple and beautiful.
Look at the texture parameters of the floor/ceiling and walls. The Brightness parameter allows you to change the brightness of the texture regardless of the brightness of the sector. By manipulating this parameter, you can create zones where it is dark, even though the eye is torn out, and the floor shines like radioactive. Or walls.
There is one such frame that can be used for your own purposes, but I do not know why. If the ceiling is the sky (F_SKY1), and in the ceiling texture settings opposite Brightness put the Absolute checkbox, then the brightness of all objects under this sky (except for your weapons) will be what value you set (from 0 to 255). That is, if you suddenly have black-and-precher everyone walking in the open air, check whether you have made the brightness of the ceiling "absolute" (or letting go of sins, I don't know).
Draw a flashlight-spotlight as follows:
Please note that we have several.
Top left (1) – fading along the length of the beam, but the brightness of the lighting also affects the ceiling, so it is made in the form of a column up to the ceiling (if the ceiling is the sky, the principle does not apply, since there is always one brightness F_SKY in the sky).
Top right (2) – the beam fades around the edges. Also affects the ceiling.
On the left bottom (3) – a low flashlight, the beam of which is made on the basis of changing the brightness of the texture of the floor. It has a kind of algorithm in standard mode – you will see when you try.
To the right and below (4) – the same lantern on the ceiling. There, the brightness of textures was adjusted in Absolute mode – in this case, the value of the brightness of the texture corresponds to the value of the sector lighting. That is, if the illumination of such a sector is 192, then the brightness of the texture should also be set at 192, otherwise, if less than 192, the texture will be dark, and if more than 192 – light. Because it's just more convenient.
And the last (5) – such a convex multisector lantern, where the beam fades in length and width. So you can at least draw the face of Angelina Jolie in vector style.
So, this light is constant, the values can be changed by scripts, functions like Light ChangeToValue. The most fancy lantern (5) has a button there. Press it, the lantern will go out, because Light_ChangeToValue (8, 192), where 8 is the sector tag, and 192 is the brightness value.
But the fact is that we still have every scripted dynamic light. Write a script of 3 lines:
Light_ChangeToValue("sector tag", random(192, 255));
delay(1); it's important, or the script will hang. In parentheses, the value is also responsible for the flashing speed
The lighting will flicker. Unnumbered lantern – just with this script.
There are presets in the editor on this topic. Very useful when laziness scripts to write on each piece of the floor, but, alas, their functionality is limited. Below is their description.
1). Light phased allows sectors to blink in turn (!) from zero brightness to maximum, but the joke was in a hurry in another. When using it, the sector brightness parameter changes the function – now it is the so-called phase index. It establishes the order in which the sectors will flash one after the other. The wiki states that it can be from 0 to 63, but in my case the values were 120-130-140 and so on. Experience shows that the numerical difference of these values (for example, each subsequent number is more than a dozen, as I have) is responsible for the flash-at-rate. Just try it and that's it. By the way, this is in a hurry on the drum, whether the sectors are joined, and the next one is not.
2). Light sequence start and Light sequence special 1/2 are similar, but there are a number of differences.
- sectors must dock.
- LS Start put on the sector, in the direction of which our light and light will flow. Otherwise, it will flash itself from 0 to 255
- LS Special 1 & 2 put in the next sectors in turn. That is, for example, 5 sectors track, in the first – start, in the next – 1, then 2, then again 1, then again 2. The flash track will go from the extreme sector (with LS Special) to another extreme sector in the track (with LS Start). Beauty!
3). Light flicker (+Light fire flicker) causes the sector to flash. It's random and looks like the flashing of a badly contacha lamp. Just for that. Important – this sector should be brighter than its surroundings, otherwise you will not see any changes. Something similar we did above the script. It is also important that several adjacent sectors with such a hurry flash not synchronously, so it is better not to do complex gradients for one poorly screwed light bulb, other things will help us here. E.g
4). Light Strobe (several types) – stable flashing sector. If the brightness of the sector is lower or equal to the surrounding/adjacent, the flashing occurs from the darkest to the real brightness value. If the sector is brighter – then from bright to adjacent. If you use this rush to several adjacent sectors of different brightness, their flickering will be asynchronous. See how this happens with the number 4. To have them flash at the same time – there is the same sync that I wrote about. So the lights flash. There's also the same "hurt-20 hp" sprint, causing 20 points of health damage to the player every second – that's on the Radiation sector.
5). Lightning + something there – these hastes refer to random flashing on the whole map and in the case of sectors only regulate the function that needs to be cut into Mapinfo, or on the line (I put the switch with this crap). I will not focus on this, since it is better to use scripts or actions on the lines to create lightning. And even better – spawner weather, because, if a thunderstorm, then with rain (on Thursday). Just look at sector "5" what it looks like and try to find significant differences. I think it's a so-so thing.
6). Light Glow – Smoothly change the brightness from one value to another. I showed 2 options. If you were in a hurry on the sector (the number 6 is so flashing), then the brightness of the sector should differ from the surrounding-adjacent, then the flashing will smoothly change the lighting from low to high. But if you use a sinter on the line (switch), and specify the sector, then there we can set the upper and lower value regardless of the brightness of the sectors themselves.
Actually, to sum up some results, I will say that all these things can be managed independently, and not just attached to the sector any one effect. After all, this method can be given to the sector by one hurry, for example, the wind, and then the lighting will have to be done by scripts. Fortunately, such actions, as I described above, there are also for activation from lines or monsters, for example. By name they are easy to find. And scripts – to create. If there is a desire – I can try to make scripts with different lighting effects in the future.
If there are any questions, inaccuracies, wishes – do not hesitate, indicate it. Suddenly, I forgot what. And in the following articles we will paint colorization and dynamic light sources, and how to play with all this.
Continuation follows. Rip and tear!