Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "Skybox Support"

From Quake Wiki

(New page: ===Abstract=== This page proposes a standard for implementing Skybox Support in Quake 1 engines. Please be aware that as the Quake 1 source has been released for a significant number of ...)
 
Line 2: Line 2:
  
 
This page proposes a standard for implementing Skybox Support in Quake 1 engines.  Please be aware that as the Quake 1 source has been released for a significant number of years, there are already diverging implementations.  The proposed standard attempts to cover the most commonly used.  Engines which diverge from the standard should be re-engineered to conform to it.
 
This page proposes a standard for implementing Skybox Support in Quake 1 engines.  Please be aware that as the Quake 1 source has been released for a significant number of years, there are already diverging implementations.  The proposed standard attempts to cover the most commonly used.  Engines which diverge from the standard should be re-engineered to conform to it.
 +
 +
If you feel I've got anything wrong here, feel free to put it right - it is a Wiki, after all!
 +
 +
===Description===
 +
 +
A Skybox consists of 6 image files, representing the 6 faces of a cube, which is then rendered at a far (but fixed) distance from the observer.  See Quake II (and others) for an example.
 +
 +
===Loading a Skybox===
 +
 +
A skybox is loaded using either the "loadsky" console command or directly from the BSP file (by specifying a skybox name in the worldspawn entry).
 +
 +
===The "loadsky" Command===
 +
 +
This command should take one argument: the skybox base name (see "Naming Convention" below).  A Quake filesystem path is not required.  If the skybox loads successfully, it is immediately used to replace the classic Quake sky.  If the skybox load fails, the current skybox (or the classic Quake sky) is retained.  The standard does not specify what happens if only some of the 6 faces fail to load.
 +
 +
===Loading from Worldspawn===
 +
 +
Need some help here!
 +
 +
===Unloading a Skybox===
 +
 +
Issuing the "loadsky" command without any arguments will unload the current skybox and revert to the classic Quake sky.  Engine coders may implement an "unloadsky" command if they wish, but this is not a requirement and should not be relied on.
 +
 +
===Image Formats===
 +
 +
Skyboxes should be provided as either TGA or PNG files.  All 6 faces should be same format (should engines be required to support a possibility that they are different formats?)  The images should be sized so that they are powers of 2: 256 x 256, 512 x 512 or 1024 x 1024 are common sizes.  The 6 faces need not be the same size.
 +
 +
===Naming Convention===
 +
 +
Each Skybox face name is composed of two components: the base name and a suffix indicating which face the image relates to.
 +
 +
The base name should be strictly alphanumeric, and should not contain spaces.  Only the base name is used for loading.
 +
 +
The suffix should be either of "bk" (back face), "ft" (front face), "lf" (left face), "rt" (right face), "up" (up face) or "dn" (down face).
 +
 +
Optionally, there may be an underscore ("_") between the base name and the suffix.  Engines should be capable of successfully loading a skybox where (1) the underscore is present in the load command and in the name, (2) where the underscore is absent in the load command but present in the name, and (3) where the underscore is absent in both.
 +
 +
===Filesystem===
 +
 +
Skyboxes may be stored in either the native OS filesystem or in a PAK file, and loading from either should be supported in any implementation.  All filesystem references are relative to the base game directory (e.g "ID1").
 +
 +
A skybox may be loaded from any of "gfx", "env" or "gfx/env"; implementations should support loading from all 3.  Skyboxes should not be present in "textures" (nor in any subdirectory thereof).
 +
 +
All 6 components of a skybox should be in the same directory.

Revision as of 23:14, 14 April 2008

Abstract

This page proposes a standard for implementing Skybox Support in Quake 1 engines. Please be aware that as the Quake 1 source has been released for a significant number of years, there are already diverging implementations. The proposed standard attempts to cover the most commonly used. Engines which diverge from the standard should be re-engineered to conform to it.

If you feel I've got anything wrong here, feel free to put it right - it is a Wiki, after all!

Description

A Skybox consists of 6 image files, representing the 6 faces of a cube, which is then rendered at a far (but fixed) distance from the observer. See Quake II (and others) for an example.

Loading a Skybox

A skybox is loaded using either the "loadsky" console command or directly from the BSP file (by specifying a skybox name in the worldspawn entry).

The "loadsky" Command

This command should take one argument: the skybox base name (see "Naming Convention" below). A Quake filesystem path is not required. If the skybox loads successfully, it is immediately used to replace the classic Quake sky. If the skybox load fails, the current skybox (or the classic Quake sky) is retained. The standard does not specify what happens if only some of the 6 faces fail to load.

Loading from Worldspawn

Need some help here!

Unloading a Skybox

Issuing the "loadsky" command without any arguments will unload the current skybox and revert to the classic Quake sky. Engine coders may implement an "unloadsky" command if they wish, but this is not a requirement and should not be relied on.

Image Formats

Skyboxes should be provided as either TGA or PNG files. All 6 faces should be same format (should engines be required to support a possibility that they are different formats?) The images should be sized so that they are powers of 2: 256 x 256, 512 x 512 or 1024 x 1024 are common sizes. The 6 faces need not be the same size.

Naming Convention

Each Skybox face name is composed of two components: the base name and a suffix indicating which face the image relates to.

The base name should be strictly alphanumeric, and should not contain spaces. Only the base name is used for loading.

The suffix should be either of "bk" (back face), "ft" (front face), "lf" (left face), "rt" (right face), "up" (up face) or "dn" (down face).

Optionally, there may be an underscore ("_") between the base name and the suffix. Engines should be capable of successfully loading a skybox where (1) the underscore is present in the load command and in the name, (2) where the underscore is absent in the load command but present in the name, and (3) where the underscore is absent in both.

Filesystem

Skyboxes may be stored in either the native OS filesystem or in a PAK file, and loading from either should be supported in any implementation. All filesystem references are relative to the base game directory (e.g "ID1").

A skybox may be loaded from any of "gfx", "env" or "gfx/env"; implementations should support loading from all 3. Skyboxes should not be present in "textures" (nor in any subdirectory thereof).

All 6 components of a skybox should be in the same directory.