Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel
Difference between revisions of "Legacy:Building A SkyBox"
m (spell fix)
m (added * moving skybox)
|Line 25:||Line 25:|
==Static Mesh Skyboxes==
==Static Mesh Skyboxes==
Latest revision as of 13:52, 2 March 2016
The SkyBox is a method of adding a continuous sky above a map.
A nice skybox adds greatly to the realism of an outdoor map or an indoor map with windows. It also adds to the realistic effect of moving from one point to another one in a map.
A skybox is much better than adding a small box containing sky Texture (UT)s just outside of each individual window.
A skybox can be almost any shape but a box is usually used because it is easier to align the textures than a cylinder, trapezoid, or sphere. A sphere should be avoided because of texture alignment problems.
Probably the best way to get to understand the design of the skybox is just open a map in UnrealEd that has sky that you like. They are generally simple; just a cube with size selected to fit the textures used, lighting, and one or two transparent sheets on top for the actual sky texture. I would suggest the CTF-EpicBoy skybox as an optimal design. They can be quite complex, however, with multiple movers and decorations, and numerous textures with different surface properties set.
Sunlights are a special kind of light, casting parallel shadows. They had to be placed in a skybox and pointed at the SkyZoneInfo actor to be effective.
A Simple SkyBox
- Subtract a box some distance away from your level (If it is too close, it may cast a shadow!) The size depends on the backdrop textures you plan to use. Say you're using a texture set consisting of 8 panels and each is 512x512. A skybox that is 1024x1024x512 high should suffice. A typical skybox is 128*1024*1024.
- Make sure your textures are aligned. You may have to select No Smooth in the surface properties to prevent seams at the edges of the sky box itself.
- You can also throw in a sheet with a moon texture in the sky or some clouds for extra foggy effect.
- Do your lighting to get it looking the way you want it.
- Add a Actor >> Info (UT) >> ZoneInfo >> SkyZoneInfo actor in the middle of the skybox.
- Back on your level, select the surfaces on which you want the sky depicted. Open the Surface Properties Window and in the Surface Flags (UT) tab check Fake Backdrop and Unlit. If you don't make it unlit than your level's lighting might spoil the nice lighting in your skybox. Experiment with this aspect if you'd like.
- Rebuild your level.
- To see the skybox projected on surfaces in the editor, make sure realtime preview mode is turned on in the 3D UnrealEd Viewport.
Static Mesh Skyboxes
This is another way of creating a nice skybox. Im using Devastation for the basic tutorial, but im sure the procedure for other editors should be roughly the same.
Tarquin: Needs rewriting so it DOESN'T use Devastation
- subtract a box a little bit away from your level. Make it 1024x1024x1024. The size does'nt really matter that much, but its better to be too big rather than too small.
- Go into the Embarcadero package and look for the sky static mesh. Many of the static mesh packages in devastation have a suitable mesh in them, so feel free to use another one.
- Place the static mesh inside the box, roughly in the middle. Add a SkyZone Info actor right in the middle of the static mesh sky.
- The fake backdrop procedure remains the same using this method so refer to the previous section for information on how to get the skybox to work.
- Rebuild your level. To view the sky, right click on a 3d Viewport and select View->Show backdrop.
Note: you can add another static mesh around the skyzone info too for added effect, although this is not vital.
UT3 no longer uses sky boxes. Instead of setting a fake backdrop surface property, maps with outdoor view now need to be crated with additive geometry and a sky dome static mesh. Open any retail map to see how that works.
UT3 Fake Skybox
While UT3 no longer has SkyZoneInfos and dedicated sky boxes, it is still possible to fake the effect with a cube map material. This cube map can either be created from a set of textures or you can use the SceneCaptureCubeMapActor to capture a live view of an actual sky box like it was done in earlier generations of the Unreal Engine.
Note: A fake sky box like this will only provide visuals. Unlike in earlier engine generations, lights in the sky box will not affect anything in the main area!
Here's how a sky box with the SceneCaptureCubeMapActor should be set up:
- Create your map and sky box area as usual
- Add an actor >> SceneCaptureActor >> SceneCaptureCubeMapActor to your sky box as if it was a SkyZonInfo. SceneCaptureActors are not static, so you could even animate it using Kismet/Matinee.
- Now you need to set up the properties of the SceneCaptureCubeMapComponent in the SceneCaptureCubeMapActor's SceneCaptureActor -> SceneCapture property.
In its Capture group, set the following properties:
- Set this to True if your sky box uses fog, otherwise keep it false.
- Set this to your sky box fog color.
- Set this high enough so all visible parts of the skybox are closer than this value.
- Set this to a value low enough that objects close to the SceneCaptureCubeMapActor are not clipped.
- Make sure this is set to SceneCapView_Lit, otherwise lights and/or shadows in your sky box will be ignored.
- Set this to 0 for a still-image sky box and otherwise to a reasonably high value so your skybox animation doesn't look choppy. This property has a huge impact on the performance of your map and higher values may cause the player's frame rate to drop due to the additional rendering work.
- This is where the actual magic happens. Use the Generic Browser's File -> New... menu to create a new "RenderToTextureCube" and assign that texture to this property. Tweak the texture's size to an acceptable value so it won't blur out when a player gets close to the window in your map's main area, but don't make it too larger either because that will affect performance similar to increasing your in-game screen resolution.
Now that you have a static TextureCube or a dynamic TextureRenderTargetCube. Note that the above procedure is very similar to setting up a surveillance camera, except that you use SceneCapture2DActor instead of SceneCaptureCubeMapActor and RenderToTexture instead of RenderToTextureCube.
Now you only need to create a material that you can apply to the surfaces where your sky box should be visible:
- In the Generic Browser do File -> New... to create a new Material, which will translate the cube map into the backdrop effect.
- Open the new material in the Material Editor.
- Add a new Texture Sample, set its Texture property to the cube map of your sky box and connect its RGB output (black) to the material's Emissive input.
- Add a new Multiply and connect its output to the Texture Sample's UV input.
- Add a new Vector Transform.
- Add a new Constant3Vector, entering the RGB values as 1, 1, -1 respectively.
- Connect the Constant3Vector and the Vector Transform to the Multiply
- Add a new Camera Vector and connect its output to the Vector Transform's input.
Once you're done, your material setup should be similar to the one shown below.
The material can now be applied to the window surface (or the sides of a subtracted cube) through which the sky box should be visible from within the main area of your map.
Note: For anyone interested, the Multiply is used here to flip the Z because otherwise the material would display the captured area inverted in the Z axis. Additionally, Multiply can be replaced with Divide (with the same RGB values) if Vector Transform links to the A input and the Constant3Vector links to the B input (A / B).
- ...with colored lighting, various textures and translucency effects. Colors
- ...with moving the skybox info actor around in your skybox and see what happens in your perspective view at the fake back drop. You'll need to have real time enabled in perspective view.
- ...with other shapes. A skybox does not have to be a box!
- ...with fog, but it might slow down your level a little. →Zxanphorian
- The Panorama brushbuilder is designed to quickly create a set of sheets to use with the skybox mountain and Skyscraper textures. You can find it in the Tarquin Brushbuilders pack.
- Skybox/FogRing Tutorial, hosted by outpt.co.uk
- Terragen is a free, photo realistic environment rendering program.