The sky in Doom engine games is a wall texture cylindrically projected and displayed in place of a flat. ZDoom also allows to use geometrically constructed skyboxes with special cameras instead of an automatically generated cylinder.
The OpenGL renderer used in GZDoom and Zandronum uses a spherical projection instead. The sky texture is rendered twice, on each hemisphere. The taller the texture, the further below the lower hemisphere will be "pushed away" on this projection, however it will not be removed entirely. (So, unless using a skybox, sky texture tiling will always happen in OpenGL; whereas the effect can be replaced by sky stretching in software.)
The flat which is replaced by a sky projection is determined in a MAPINFO GameInfo definition with the skyflatname property. By default, it is F_SKY1 in Doom, Hacx, Heretic and most other games; it is, however, F_SKY in Hexen and F_SKY001 in Strife.
The choice of the texture projected as the sky is set in a MAPINFO map definition with the sky1 and, optionally, sky2 properties. It can be overridden by using a skybox or by using the MBF sky transfer effect (Static_Init property 255).
Since Hexen features two different skies per level, sky1 and sky2 as defined in MAPINFO, it provides a mechanism to use two different skies in the same map, provided that a double sky is not used. Normal sectors with a sky flat will show sky1, however sectors of type 200 will show sky2. The alternate sky is also used by lightning.
Hexen introduced the double sky effect, also known as parallax sky. If the doublesky property is set in a map definition, the two textures indicated for sky1 and sky2 will be combined: the areas of sky1 which are of color index 0 will be transparent and show the sky2 texture. This becomes interesting when both skies are given different speed values.
Note that double sky requires both sky textures to have the same dimensions.
If there is a ceiling height difference between two neighboring sectors using a sky ceiling, the upper wall texture on the linedefs separating both sectors will not be displayed, creating the illusion that the sky is continuous. This is referred to as the sky hack in the Doom engine source code, and is used in many original levels to vary the heights of buildings in an outside area. Projectiles that hit a sky flat, or the upper part of a linedef hidden by the sky, will vanish entirely instead of exploding as they would on a non-sky ceiling or wall. Note that this sky hack is not extended to sky floors.
Sectors with a sky ceiling are considered to be outside. This affects fog and lightning. Sectors without a sky ceiling need to be of type 87 to use the outside fog value, and of type 197 to use the outside lightning effect. Sky floors do not result in a sector being considered to be outside for any purpose.
By vertically stretching the sky texture, ZDoom can avoid tiling it, which would look odd. However, the stretching effect does not necessarily look good either.
In either case, it is meant to compensate for looking up, and tiling might still happen when looking down.
The two screenshot collages show the effects of a stretched sky compared to unstretched sky. On the first screenshot, the mountains look normal when unstretched, and are too high when stretched. But as seen on the second, the mountains become tiled in the sky when aiming upward if they are left unstretched.
Sky stretching also depends on sky texture height:
|Less than 128||The texture is always unstretched, centered on the horizon, and tiled above and below.|
|128 or more, but less than 200||Sky stretching is optional and governed by the r_stretchsky console variable.
If unstretched, the baseline is 28 rows below the horizon so that the top of the texture aligns with the top of the screen when looking straight ahead.
If stretched, it is scaled to 228 pixels with the baseline in the same location as an unstretched 128-tall sky, so the top of the texture aligns with the top of the screen when looking fully up.
|Exactly 200||Unstretched, baseline is on horizon, and top is at the top of the screen when looking fully up.|
|More than 200||Unstretched, but the baseline is shifted down so that the top of the texture is at the top of the screen when looking fully up.|
In all cases, tiling may happen when looking down, for example when a sky floor is used or if the sky is allowed to go below the horizon. A texture needs to be at least 544 texels high to avoid any sort of tiling.