Enviornment Maps in UT
By:
Adam ‘Muad'dib’ Stiles
http://www.planetunreal.com/muad
PRE-REQUISITES:
A basic knowledge of UnrealEd
An Q2 or Q2-like env map (try one from my env maps section)
Today I show you how to use all those env maps that I have for download in the env maps section.
So just what the heck is an env map? It's short for "environment" map and is basically a set of 6 square images when mapped onto the inside of a cube, form a panoramic view of an environment. Think of it as standing inside a perfect cube shaped box - now take one image out of the set and plaster it onto a wall on the inside of this cube. Keep doing this for each wall (ceiling and floor included) such that the images tile from side to side, top to bottom. Env maps are the choice of sky implementations in the Quake 2 engine, so you might have seen quite a lot around the internet, well, today I'm going to show you how to adapt them to use as skyboxes in Unreal Tournament.
First things first. You're going to need an env map that's been made for Quake 2. I've got several for download myself, but you may also choose to use someone elses Quake 2 / Half-Life env maps. Note that in my downloads I've included a bunch of TGA files. They are in that format for a particular reason - TGA will support millions of colors with a slight compression ratio. This way you can *alter* (remember to still give me credit if you decide to alter use my env maps) the env maps in your favorite photo editing softwarewithout loss of quality. Not to mention Quake 2 env maps, by default, are in TGA format (at least those are the ones we are going to use) and I want you to get the WHOLE process here for learning purposes. Now let's get to it! SKYZONING:
You should have an env map by now. Whether or not you got one of mine or someone elses, put all the TGA files (6 of 'em) into a directory of their own (for neatness' sake). Open up your editing software (I'm going to assume Photoshop, but this can also be done in Paint Shop Pro which you can download a trial of at http://www.jasc.com) and load all 6 of those TGA files up. Now, UnrealEd doesn't like TGA files - it likes BMP files. So we're going to have to do some converting. So in Photoshop with your TGA files open:
Goto Image->Mode->Indexed_Color with these settings:
Palette = Adaptive
Colors = 256
Forced = Black and White (this selection is for Photoshop 5.5)
You'll probably want a diffused dither as well, doesn't make a LOT of difference - the above settings are the important ones.
After you've done that, save the image in the same directory with the same name, but as a bitmap file (BMP extension). Do this for ALL 6 images.
Now you should have 6 BMP files, each one 256 colors. You're ready to fire up UnrealEd now, so go ahead and do that.
Now, our env map is going to work just like a regular sky box in Unreal which means we need those BMP files as separate textures in UnrealEd, so select the Texture browser. Click on the "Import" button at the very bottom of the Texture browser. Then find all those BMP files you just made and highlight all 6 of 'em. Then click the "Open" button and you'll be prompted for some information:
Name = This is the name of the image, just leave it at the default
Group = You can leave this at the default as well
Package = This is important. Type a name here that you want the env map to be known by - this will also be the name of the texture file (UTX) that you save as. For this demonstration we'll use "ENVMAP1" (no quotes), but could just as easily have used something else.
Make sure the "Generate Mipmaps" option is checked and then click the "Ok to All" button.
UnrealEd will start working for a moment and when it's done you should see all 6 of your env map images in your Texture browser ready to use. Now let's make a skybox to use them on!
First right click on the cube brush tool button:and goto "Cube Properties". Make sure you have the height, width, and breadth set to 256. NOTE: You can use wall sizes of any size really, multiples of 256 are best, it just means you'll have to resize the textures later and we wanna keep this simple.
After setting the size dimensions, click the "Build" button and you should have a 256 cubic brush in your view now. Go ahead and close the Cube Brush dialog.
Now select a DIFFERENT texture - something that clashes with your env map (I know, just stick with me here). You want to be able to easily distinguish the map from the texture. Now on your Texture browser you should notice three drop down menus. The first is to choose what kind of things to browse (Classes, Sounds, but in this case Textures). The second is the differnt Texture packages you can browse within. The third is usually categories for the chosen texture package. From the SECOND drop down, select "Engine". Then click on the green-scaley looking texture called "DefaultTexture" - good name for it huh?
Now click the Subtract Brush button:to create your basic skybox. You should have a cube with that scaley texture all over it. Now go back and select "ENVMAP1" from that second drop down list.
Now the fun part, we're going to map the skybox. These instructions are important. You'll notice that (if you used a Quake 2 or one of my env maps) the names of the textures will end with "bk", "ft", "lf", rt", "up", or "dn" These tell you what walls for the Quake2 engine to put the texture on. They'll also be our markers for putting the right textures on the right walls.
Here we go:
In the 3D view, face a wall (not ceiling or floor) - highlight it (by clicking on it in 3D view) and put the texture ending in "ft" on it. Now in 3D view turn to the right to face the immediately adjacent wall.
On this wall place the texture ending in "rt". Turn right again to the next immediately adjacent wall.
On this third wall put the texture ending in "bk". Turn right once more to the last wall (minus ceiling and floor which we'll do in a second here).
On the fourth wall put the texture ending in "lf".
Now, put the texture ending in "up" on the ceiling, and the texture ending in "dn" on the floor. Don't worry if they don't look like they line up right. We'll fix it soon.
You should now have a skybox with all 6 of your textures used. Now, odds are that you have a problem: The ceiling and the floor don't "mesh" with the rest of the textures seamlessly. Well, they WILL. We just need to rotate those two textures to fit right.
First click on the ceiling in 3D view to highlight it - then right click on the ceiling in 3D view and goto "Surface Properties" Under Surface Properties, click the "Rotate" tab. Click the "+90" button until the ceiling lines up seamlessly with the walls.
Repeat this same procedure for the floor.
You should now have a nice looking skybox! NOW - there have been some cases, from my own experience, that importing these textures like this and placing the textures on the walls winds up producing light colored "lines" along the seams. That is you can see that the images line up correctly, but there are visible seam lines on the edges of the cube. IF you experience this, then follow the directions below. Otherwise you can skip to the "SKYZONING" section below.
FIXING THE LINES:
To fix those lines, we're going to trick UnrealEd a bit. Highlight any wall of the skybox in 3D view and press SHIFT-B to highlight all the sides, top and bottom. Right click on any of the sides and goto "Surface Properties (6 Selected)".
What seems to cause the problem is texture size for some reason - I think sometimes the texture comes out smaller than needed so it wraps around causing those visible "lines". So to get rid of them we're going to scale the texture size up by a very small amount to get rid of the wrapping around. Click on the "Scale" tab and enter the value "1.01" into the number entry box under "Simple Scaling" - then click the apply button. If all goes well, your 3D view should show that the lines are gone. You may also have to adjust the position of the WALL textures only by using the "Pan" tab, then adjusting the position with the pan buttons.
Now that the textures are on your sky box and you're sure they work well - you're going to want to save them into a package that you can then distribute with your map. After all, not everyone is going to have your new textures and they'll need 'em to get your sky box working right! So in your Texture browser make sure you have "ENVMAP1" selected in the second drop down box, and then click the "Save" button at the bottom of the browser. It should pop up a dialog wanting to save it as "ENVMAP1" in your UnrealTournament\Textures directory with a UTX extension. Go ahead and click "Save" to save the package. It's important that you include this UTX file with your map when you distribute it. And make sure that the people playing your map put this UTX file in their UnrealTournament\Textures directory before attempting to play your map. Otherwise it just ain't gonna work.
Unreal uses sky boxes differently than Quake2 does. Our env map was designed for Quake 2, so we'll need some more adjusting of things to make it look correct in Unreal. Every sky zone requires a "SkyZoneInfo" actor inside it somewhere. You can find it by browsing "Classes" (top drop down list in the before mentioned 3 drop down lists). Then expand "Info", then expand the subclass "ZoneInfo" - there you'll find a "SkyZoneInfo" class. Being a subclass of "ZoneInfo", a "SkyZoneInfo" can do pretty much the things a ZoneInfo can. However, it's a *special* ZoneInfo that says "Hey, this area I'm inside of is intended to be a sky!" So highlight "SkyZoneInfo", then right-click on your grid (inside your skybox) and choose "Place SkyZoneInfo here". Now position the thing so that's it's DEAD CENTER in the sky box from all views. There's a paramter you need to set on this thing now. Our env map looks kinda the way we want it already. We don't want any extra lighting effects, so right-click the SkyZoneInfo and goto "SkyZoneInfo Properties".
Under the SkyZoneInfo's properties expand ZoneLight and set the AmbientBrightness = 255.
That should do it! Now just build yourself a typical level there that you'd like to use your new skybox with, and set the ceiling's "Surface Properties" to have "FakeBackdrop" checked. That will tell Unreal to draw your sky on that surface instead of the regular texture. Then fire up UT and admire your new sky!
Have fun and enjoy converting all those Quake 2 env maps you used to like! :)