The cloud layer (or
layers) is drawn as on a sphere. Now, if you have a
farbox, the bottom of the skybox will be drawn
properly. If you do not, then the bottom will get
the HOM effect. So, when using only cloud layers,
the bottom of the skybox must be kept from sight.
And like I said, trying to move the sky brushes wont
work. You probably know this already.
Farbox Script
This script draws a
farbox without any cloud layers. For a full(er)
explanation of the keywords and commands, get Id's
official shader manual.
_________________________
textures/papas_stuff/bongosky
{
qer_editorimage textures/papas_stuff/bongosky.tga
surfaceparm noimpact
surfaceparm nolightmap
q3map_globaltexture
q3map_lightsubdivide 512
q3map_surfacelight 100
skyparms env/bongo 256 -
}
________________________
The first line two
lines we know from the previous tutorial. The editor
image is actually the cloud layer image, but its not
used else where in this script, yet. The next two
lines are surface properties; 'noimpact' means that
weapons will not hit this surface, i.e. no marks or
explosions. 'nolightmap' makes it so that light or
shadows are not drawn on the surface.
The following three
lines are commands for the compiler.
'q3map_globaltexture' somehow improves how the
shader looks/works when drawn over several brushes.
I am not sure it is needed until we add the cloud
layer. 'q3map_lightsubdivide' defines how large the
triangles of the textured surface are. Here we have
set it to 512 game units, which is quite large. I
believe this results in less precision in the
calculation of the lightmap as far as the light from
the sky is concerned. But it is said to be faster,
default is 120. 'q3map_surfacelight' defines how
much light the surface emits. Since the sky is
rather big, 100 is enough for me (500 or so should
be like daylight). The color of the light is
calculated from the textures. The light seems to be
calculated from the actual brushes, so moving the
sky away from the player will dim the light around
him.
The last command,
skyparams sets the textures for the farbox, the
height/curvature of the clouds and possibly the
textures for the nearbox. 'env/bongo' is the
directory and the first part of the file name for
the six textures needed for the farbox. The second
part of the file name specifies which side is which.
In this case, they should be named like so:
bongo_up.tga (up),
bongo_dn.tga (down), bongo_bk.tga (back),
bongo_ft.tga (front), bongo_lf.tga (left), and
bongo_rt.tga (right).
These are the files
q3 will look for in the /env folder if skyparams is
set to env/bongo. 256 is the height of the box, and
the '-' means that we wont be using a nearbox. If
you don't have a far box either type '-' instead of
the env/bongo part.
Blue is nice, but
kind of boring and cloud layers are actually the
important part of this tutorial, so lets add one.
__________________________
{
map textures/papas_stuff/bongosky.tga
blendFunc add
tcMod scroll 0.05 0.06
tcMod scale 3 2
}
__________________________
When you add this
stage to the fist script, Q3 will load the image
bongosky.tga, blend it with the background and then
continually modify its placement. Tcmod modifies
texture coordinates. Here we use two functions
scroll, that moves the texture, and scale that
changes its size. Try adding 'tcmod rotate 5' or
changing the values up and down. to see what they
do.
Making a good sky can
be rather tricky. More often than not you end up
with something out of a LSD trip. The images you use
for the clouds, and more importantly, a farbox, must
tile seamlessly. If they don't, it will be easy to
see where one texture ends and the next begins and
this completely destroys the illusion. The farbox
will look like, well a big box.
I have made a pk3
file for you. It contains the sky shader we made
here as well as another one with a slightly more
colorful farbox. Put it in your baseq3 directory,
add 'bongosky' to the shaderlist and load the
papas_stuff directory in q3radiant to use them. Then
brake them apart and mess them up!
(Also, take a look at
the original skies shader file. You will notice that
most shaders do not use a far box, but an un-blended
cloud layer.)
Papa
Bongo