Let’s have a look at the skies in Ace Combat 3.
Each mission comes as a packed archive (ULZ-compressed). Files in that archive can either be files, or other archives. The result is some kind of hierarchical file system.
The very first file in each mission describes the sky. It contains several colors:
The exact definition is:
// PlayStation color; “x” unused struct PSXRGB { uint8_t r, g, b, x; }; // Little Endian! struct SkyboxFile { uint8_t unknownA[4]; PSXRGB groundColor; PSXRGB horizonColor; uint32_t unknownB; uint32_t unknownC; PSXRGB skyColor1; // slightly above horizon PSXRGB skyColor2; PSXRGB zenithColor; uint32_t unknownD; PSXRGB sunColor; PSXRGB ambientColor; uint16_t always8[8]; // don’t ask me why int16_t sunElevation; // details below int16_t sunHeading; // details below };
The color values can be used to build a skybox. The angles relative to zenith seem to be:
The ground color starts below the horizon, because otherwise AC3’s short draw distance couldn’t cover it with terrain.
It’s hard to reproduce the color gradients exactly, as they depend heavily on the PSX’s blending and gamma curve. The conversion of PSXRGB to sRGB and proper interpolation could probably fill another article. But these are pretty close for all Japanese missions:
Note that AC3, for vertices close to the sun, mixes the sun color into the sky color at 80°. This makes the east appear red during sunsets.
The sun position can be determined from sunElevation and sunHeading:
Night missions often use the sun too, but they put a moon texture in its place.
Clouds and sun flares are stored as textures and blended onto the skybox. The according TIM files can be found in the 15ᵗʰ archive of the mission.
Contrast is pretty low. We can assume that they are placed on billboards and rendered with additive blending over the sky. (The PlayStation does not support other blending modes that could be useful here.)
All missions have the files mentioned above, but not all actually make use of them. Electrosphere and the space mission Zero Gravity are good examples: There is no sky in outer space!
In this case, the game uses hard-coded special effects instead.
If these two missions used their skyboxes instead, their background would be hazy with a red horizon towards the sun!
The skybox file contains more data. I’m not sure what it is, but it could be a fog color table to accelerate blending of polygons with the horizon during rendering.
It could also be stars. Ace Combat 3 does have stars in its skies – just a few during dusk/dawn, but many at night. However, I don’t know if these are stored per mission, or hard-coded in the executable.
I will have a look some time later!