A Quake3 sky is made from two components: a ‘skybox’ and a cloud layer. These components can be used together or individually.
Prerequisites
A sky shader should always contain several surface attributes. A sky shader without the skybox or cloud layers would look like this:
{
surfaceParm nolightmap
surfaceParm noimpact
surfaceParm sky
q3map_sun ? ? ? ? ? ? // optional
q3map_surfaceLight ? // optional
qer_editorimage textures/mysky.tga
}
The three surfaceParms make the sky surface behave like a sky. The optional q3maps add extra behaviour in the form of a sun and some surface lighting.
Skybox
A skybox simulates a sky by drawing a cube around the player with texture maps on the inside faces. The cube is drawn so that the player is always at the center of the cube, and the rest of the level is drawn in front of the cube faces. The skybox shows through surfaces with a surfaceParm sky. For a more detailed explanation see the skyParms attribute.
Note: the Quake2 sky was a skybox.
{
surfaceParm nolightmap
surfaceParm noimpact
surfaceParm sky
qer_editorimage textures/mysky.tga
skyParms env/space - -
}
This shader is the same as the basic sky shader except for the new skyParms attribute.
Cloud Layer
A cloud layer simulates a sky by texturing a sort of squashed sphere around the player in a similar way to a skybox. The difference is that the parts of the sphere close to the ground plane are not drawn, giving a HOM effect if they are visible. Also, the apparent height of the cloud layer is adjustable.
Note: the Quake1 sky was a cloud layer.
This shader adds a scrolling cloud layer to the basic sky. The 512 in the skyParms attribute sets the height of the cloud layer.
{
surfaceParm nolightmap
surfaceParm noimpact
surfaceParm sky
qer_editorimage textures/mysky.tga
skyParms - 512 -
{
map textures/skies/inteldimclouds.tga
tcMod scroll 0.15 0.15
}
}
This shader adds an extra, transparent layer of clouds. It does this by using an additive (GL_ONE GL_ONE) blend. Note that if more than one stage is used the first map must have a depthWrite attribute.
{
surfaceParm nolightmap
surfaceParm noimpact
surfaceParm sky
qer_editorimage textures/mysky.tga
skyParms - 512 -
{
map textures/skies/inteldimclouds.tga
tcMod scroll 0.15 0.15
depthWrite
}
{
map textures/skies/intelredclouds.tga
tcMod scroll 0.05 0.05
blendFunc add
}
}
Combining Skyboxes And Cloud Layers
To combine cloud layers and skyboxes just make sure all the cloud layers are partly transparent. For example:
{
surfaceParm nolightmap
surfaceParm noimpact
surfaceParm sky
q3map_sun ? ? ? ? ? ? // optional
q3map_surfaceLight ? // optional
qer_editorimage textures/mysky.tga
skyParms env/space 512 -
{
map textures/skies/intelredclouds.tga
tcMod scroll 0.05 0.05
blendFunc add
}
}