Note: This tutorial is to make a basic sky, it won’t move or do anything fancy, as I myself don’t know how to do that yet. However I wanted to write this basic tutorial because when I was trying to find out how to do it I had to look at a few different threads, and peace together the information.
A bit about skyboxes-All a “skybox” is, is a texture with a shader that points to 6 .tga files. It does not actually need to be a box. If you have a window, all you need to do is put a brush on the outside of it, and apply the texture. Basically the brush with the texture applied to it will act like the “window” into your skybox. So no matter how far or close the brush is to your position, the image on it always looks the same to you.
Getting the 6 .tga files-You could create your own from a program called Terragen (
http://www.planetside.co.uk/terragen/ ) the site says its free for non-commercial use. Or you could go to this site
http://www.scentednectar.com/skyboxes/ and download some that are already made.
Convert them to .tga format, and naming them-You will notice that these files are in .jpg format. This will not work with Doom3, so you need to convert them into .tga files. Using Photoshop this is very simple, just paste the image into a file, and then save it as a .tga file.
Save them with “_possition” at the end… so if you want to call your skybox “cloudyday” you would name the six images as follows “cloudyday_left” “cloudyday_forward” “cloudyday_right” “cloudyday_back” “cloudyday_up” “cloudyday_down”
If you get your images from the website above they are already named in such a way that they are easily identifiable, if you have images that are not identified, be careful to get them in the right order, or your sky will have seems.
Putting your images in the right place-
You do not put your images in the texture directory. This is a bit counter intuitive, and it confused me, till I found out were to put them. In your Doom base directory create a directory called “env” inside make another directory called “custom” and put your 6 .tga files in there.
Pick one image (does not matter what one) and put it into base/textures/custom/skies name is simply cloudyday.tga. This is the image you will see in the editor.
Getting your shader ready-
You will need to have a shader to tell Doom3 what to do with your 6 .tga files. The easiest way is to cut N paste what I have into a Text doc. And save it as Customskies.mtr, then place it in your base/materials directory.
Code:
/////////////////////////////////////
textures/skies/custom/cloudyday
{
qer_editorimage textures/custom/skies/cloudyday.tga
noFragment
noshadows
nooverlays
forceOpaque // so transparent windows can draw on top of it
{
blend add // so transparent windows can draw on top of it
cameraCubeMap env/custom/cloudyday
texgen skybox
texgen wobblesky .0 .0 .0
}
}
/////////////////////////////////////////
When you want to create another sky, you do not need another .mrt file, you simple make another instance of the script inside the .mrt file and change the variables on it.