Liandri

The forum offers unofficial support for UnrealEd users and serves as a comfortable rest-room for a friendly community.
 
HomeFAQRegisterLog in

Share | 
 

 Creating a Skybox

View previous topic View next topic Go down 
AuthorMessage
Murphy



Posts : 147
Join date : 2008-10-18
Age : 29

PostSubject: Creating a Skybox   Sun Jan 25, 2009 6:57 pm

What is a Skybox?
A Skybox is a small 3d background model of the sky that is going to be used instead of a real sky over and/or around your map. It is to your map what a matte painting is to an old movie. Imagine a film team shooting a relatively static scene in western-movie in an area without desert. They aren't going to build a huge artificial desert as a backdrop for their movie. What they do is they put up a picture of a desert and film in front of it to create the illusion that the scene really takes place in a desert.
It's very similar in UnrealEd. Creating a huge landscape and a high sky with real clouds in it is impractical because a) you have to create a whole lot of content and b) UnrealEd has to calculate it. Instead we opt for the UnrealEd version of a matte painting: The Skybox.

How does it work?
If we had a cube with the playable area of a piece of landscape at the bottom we can't just put up matte paintings at the corner, ie assign sky-textures to the sides of the cube. If a player moves around in the level he will see that he can move closer to the "sky" or move away from it and he will know it's just a plate with sky painted on it. Ideally the sky should appear as if it was so far away that no matter how far the player ran he would never get the feeling of getting nearer to it. Go out at night and try running towards the moon. You won't get closer to it.
To make this illusion work, we have to use the Skybox system.
The Skybox is a zone somewhere, which looks like a miniature sky-model. It could be a cube with sky-textures on its sides (read here how to generate such textures with the program "Terragen"). Inside this cube there will be something like a small camera that always looks in the direction the player is looking, but contrary to the player it won't move. Next up the surfaces in the playable map area where the sky is to be shown we will tell UnrealEd to show the output of that camera.
If the player looks skywards in-game then he will see the sky but no matter how close he gets to the "sky"-surface, he will always think the real sky is infinitely far away.

How do I set it up, then?
First we will create the Skybox. Simply create a zone which has no connection to the rest of your level. If your level is a giant subtracted cube with a terrain in it, just subtract another cube outside of it. Decorate the Skybox. If you are mapping for UT2003/4 there is a package called "SkyRenders.utx" that includes some sky textures you can use for now. If you are happy with the appearance of your fake sky we can move on to the next step: Telling UnrealEd that this zone is your fake sky and setting up the "camera" I was talking about earlier. Both is done by placing a SkyZoneInfo into your Skybox. The SkyZoneInfo marks the Zone it is in as the SkyZone and it is the "camera". If you are using a Skybox with pre-rendered sky-textures you should place it where the point-of-view for the pre-rendered environment is so the perspective fits.
This is what it could look like:

By xMurphyx

Now the Skybox will be shown in-game instead of Backdrop (Backdrop is what is shown where nothing else is there to be shown. If you look into Backdrop in-game without a Skybox the engine just uses the last frame there again, because it has nothing to replace it with, which makes it look as if everything was blurred and streaking). We can't create Backdrop everywhere we want to have to have the sky seen but we can simply set surfaces to fake this Backdrop. Open the surface properties of the surface in question and check the Fake Backdrop box.
Rebuild for the changes to take effect and the Skybox to become active.
To see the backdrop/fake backdrop/ie Sky in the Editor too, rightclick the top of your 2d viewport and select View -> Backdrop.

By xMurphyx

Note:
-If you want to use a cube with skytextures on its sides, make sure to set the surfaces to "unlit" or else they will be black if they are not lit.
-Coronas do not work in a Skybox as technically the player has no direct line-of-sight to it.

The fog-problem
If you set up distance-fog for a Zone in your map and the maximum view-distance is shorter than the map would geometrically allow you to see, everything behind the maximum view-distance of the fog will be cut off. This can be used to improve the performance of your map as less has to be rendered at once, but it can also be a simple matter of ambience. The problem with this is that where the fog cuts off there is nothing to be shown so what is shown is Backdrop. If you have a Skybox you will see it instead.
Here is a screenshot looking down a corridor. It is longer than the fog allows me to see so it is cut off at a certain point. I circled the area on the screen where backdrop (or in our case: The Skybox) would be shown:

By xMurphyx

So in-game I would see the corridor ending there and I could see the sky. This is unrealistic as the corridor goes on after that point (!), it just isn't shown. As soon as I move down the corridor I can see the sky dissapear again as I move through the fog until the end of the room is closer to me than the maximum view-distance:

By xMurphyx

What we want is that instead of the backdrop/sky we want the solid fog color shown where the fog ends.
The solution is that we set up a so-called fog-ring. A fog-ring is a ring-model in the Skybox which is colored like the fog and is opaque at the bottom and translucent at the top.
Here is what it could look like:

By xMurphyx

In a huge out-door map we would see parts of the terrain and objects that were cut out by the fog pop into view as we move closer to them. With the fog-ring in the skybox we see everything dissapear in a fog-colored haze but looking up we can still see the sky!

Here is a screenshot of ONS-Dawn without the fog-ring. As you can see the objects dissolve into the grey fog color until they are apruptly cut off and everything dissapears into "sky":

By xMurphyx

Here is a screenshot of the same scene with the fog-ring. It is technically exactly the same, but as the skybox was altered to be grey too where the objects disspear into it in-game (with the fog-ring!) it looks natural and smooth:

By xMurphyx
Back to top Go down
View user profile
Shadowwill



Posts : 26
Join date : 2009-01-04

PostSubject: Re: Creating a Skybox   Mon Jan 26, 2009 9:13 pm

great, thanks for that murphy !
Back to top Go down
View user profile
 
Creating a Skybox
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Creating the account (URL) globally and using that variable where ever it needed
» [ANSWERED] Creating .iso File = very slow [latest Version]
» How to decide which framework is best for your project.
» Sample UI Element file for google site.
» How to create a test suite in Selenium?

Permissions in this forum:You cannot reply to topics in this forum
Liandri :: = Tutorials :: UnrealEngine 2-
Jump to: