Generating custom skys using Terragen 1

If you know something thats not in here please share it
Post Reply
Sgt.Killboy
Posts: 59
Joined: Thu Mar 24, 2011 6:16 pm

Generating custom skys using Terragen 1

Post by Sgt.Killboy »

Requirements for this tut:

-brains
-Photoshop or any other Image Editing Software with DDS plugin (Plugin can be found at the tools section)
-Terragen
-MDT or any other program you can unpack and pack rfa files with


To generate skyboxes, there's a pretty cool tool available for free non commercial use called Terragen.

For download go here:

http://www.planetside.co.uk/content/view/16/28/

The non commercial version is limited to render images in a resolution of 1280x 960 (or less). If you'd like to get an image of 1024x1024 simply resize it, when you come to the photoshopping part.

Okay. Let's go! Since Terragen is a pretty complex little program with a lot of things that can be adjusted, i will only talk about the basic settings to be made, to get the stuff ready to be used in BF1942 (and also in BF:V and BF2. For BF2 the imagefiles have to be changed/converted to a skydome with HDR shop. Another tiny tool...just to mention).

So what is a skybox?

A skybox is...well...it's an inverted box that surrounds the terrain in BF42 maps with 5 (or 6) texturetiles on it, to show up as sky ingame like so:

Image

You see....the texture tiles fit perfectly at the edges.

When opening Terragen, the rendering control an the landscape dialog boxes will pop up. You can test render a scene right now, by hitting "render preview". The quality settings (Detail) should be set to high and "render landscape" can be unticked.

You can also hit "Render Image" The result will look like so:

Image

Now what we got here, is an image of 640 x 480...as you can imagine, we need one thats a square. So first we go to image size in the rendering control of terragen and change the settings to maybe 512 x 512. If you hit render now, the result will be a square image.

If we'd render the skybox by now, we would get a result similar to this one:

Image

As you can see, the edges don't fit like they should.

To get them to fit seamless, we need to change some settings in the rendering control and the camera settings:

Image

That is in words:

Camera position in rednering control x and y set to 128

Zoom / magnification in Camera settings set to 1

Now our camera position and zoom are ready to get to the rendering process. What we need to change now is the camera orientation.

Set all the values for head, pitch and bank to zero. The camera will now spot from the center to the north.

Image

Now hit render and save the result as maybe "1.bmp". The following steps will be to change the "head" value. First change it to 90. That is 90 degrees and means the camera will spot to the east.

Hit render. Save as "2.bmp".

You might know by now, what to do next. Set the "head" value to 180 to make the camera spot to the south, hit render, save as "3.bmp" then set the "head" value to 270, hit render, save as 4.bmp.

Now you got the 4 sides of the box. To get the top, you need to set the "head" value to zero and set the "pitch" value to 90. Hit render, save as 5.bmp.

Now our skybox is ready to be edited in photoshop or whatever program you use. Open the 5 tiles and start with "1.bmp". Add a new layer to the image, and choose the colorpicker (hitting i in Photoshop for the tool). Pick a color from maybe the middle of the picture and fill the new layer with the paint bucket tool. (hitting G in Photoshop for the tool). Now use the rubber tool (hitting E in Photoshop for that) with soft edges to erase the part of the new layer, thats above the horizon level.

The best way to get a good result is to set the new layer to 50% opac to see the skyline and to use the rubber tool with pressing shift while erasing, wich will affect the rubber tool not to break out vertically...it will erase an exact horizontal line.

Image of the 2nd layer:

Image

Now erase the rest of the top part. The image should look like that in the end:

Image

You can now start saving the 1st picture. When saving it, use the name of the sky, you use in your map. Lets say you use the kursk sky, save it as "sky_kursk_01.dds" Save it in DXT1 (no Alpha) format.
Now get your second image "2.bmp" and drag the blue layer of image 1 to it. It hast to fit exactly like on "1.bmp" so auto snap in Photoshop should be enabled by hitting Ctrl+Shift+, (that is in words Ctrl and Shift and comma...just to mention...looks a bit confusing to have the comma there).

Save the image as "sky_kursk_02.dds". Continue with images 3 and 4. Image 5 will just have to be saved as "sky_kursk_05.dds" with no editing.
Now create a 6th image of 64 x 64 pixels size and fill it with the color you took to fill the 2nd layer and save it as "sky_kursk_06.dds". 64 x 64 is because the dds plugin only allows export of 64 x 64 or 128 x 18 or 256 x 256 and so on.
I forgot why it's good to have that 6th image, but i know, there was a reason to have it...

Well now the only thing you have to do is to unpack your map, create a folder in the maps directory called "Texture" and put the image files in there. Now to get BF42 to read them, you will just have to add the following codeline to the init.con file of the map:

Code: Select all

textureManager.alternativePath bf1942\levels\YOUR MAPS NAME HERE\Texture
Thats how it should look like:

Code: Select all

rem *********************************************
rem Created by Battlecrap 1942.  Copyright (c)2003 Digital Disillusions CE
rem *********************************************
ShaderManager.setTextureParam envmap bf1942\levels\Green_Hell_New\Textures\ENVMAP_G_.rcm
renderer.globalLodPercent 1
renderer.globalAmbientColor 0.094118/0.094118/0.094118
renderer.ambientColor 0.109804/0.109804/0.109804
renderer.diffuseColor 0.309804/0.384314/0.203922
renderer.specularColor 0.294118/0.294118/0.294118
renderer.vertexFogEnable 1
renderer.fogColorVec 0.047059/0.101961/0.019608
renderer.animatedMeshAmbientColor 0.15

!!!---> textureManager.alternativePath bf1942\levels\YOUR MAPNAME HERE\Texture <---!!!


shadow.shadowColor 0.550000

Game.setViewDistance 400
Game.spawnPlayers 1
renderer.fogstart 0
renderer.fogend 150
Now pack your map and watch the sky ingame.

Additional tip:

In some cases it's a good idea to have the same color for the 2nd layer you use and the fog color of your map. like if you got a desert map, with fog set to some sandy color what makes hills and stuff thats far away appear in that color, fill the skyboxes lower part with that color, to make sky and fog blend nicely.

The easiest way to get the fog color to work with in Photoshop, open your map in BC42 and open the fog dialogbox. Click the color to get the colordialogbox opened.

Image

Now take a screenshot by hitting the print key on your keyboard. Open Photoshop, create a new image and paste the screenshot to it by hitting Ctrl+V.
You can now use the colorpicker or set up the color by using the RGB values that show up in the color dialogbox of BC42.
__________________________

I hope i didn't forget mayor parts like in the nightmap tutorial.

__________________________

P.S.: To get into Terragens settings like skycolor, clouds appearance etc. use google to search for tutorials. There is some to be found.
My anger management class pi**e* me off.
Image
Post Reply