Unreal Engine Part 5: Introducing the skybox
Rob Redman continues his comprehensive video tutorial series for Unreal Engine with chapter 5: introducing the skybox...
The single biggest impact you can have on your level is the overall sky and lighting, so in this episode we are going to look at the sky. There are limitless options for working here but to start you off we will look at the default sky blueprint (a self-contained preset asset is called a blueprint in UE4) in conjunction with a little post processing.
Open up your level and lets do a little house cleaning before we begin. In your Outliner (top right panel) click the new folder button and name it props or foliage. Select all the actors that you have added, from grass to flags etc and drag them into this folder. This will just help you to navigate your level more easily, as you can close the folder. Now select the sky and lighting you have and delete them.
Blueprints can be seen as mini self contained levels that can be incorporated into your projects and we will make one for our sky. In the content browser right click and choose new blueprint. In the pop up that follows choose Actor. Rename the blueprint to SkyBP and double click it to open the blueprint editor.
In the Components tab you need to add a new component and choose Static Mesh from the dropdown menu. This creates a non moving giant sphere around our world. In the details tab in the static mesh section search and add a SkySphere to tell UE what type of mesh we want. You can see this also adds a material for us (the same one we had on our original sky). You may wonder why I've got you making something we already had but it's important to see how things fit together before we change them.
In your materials folder add a new material and rename it SkyMat, then open it up. In the details change it's type to Unlit and make it double sided. This changes the shader method so we can make it generate light. You'll notice the inputs change on the node.
We can add anything we like as a colour here, from a cubemap, to a constant or a gradient but we need to tell the system how to react, so add a constant3, a constant and a reflection vector world space node.
Connect it all and add a texture
You could choose many things as your colour channel but I've gone for a lovely sky image. If you choose an image you'll need to import it into your textures folder then add a texturesamplersubUV node and drag it onto the default texture in the details tab. It will probably be too bright, so change the constant to a value of 1, so that the divide node can balance the intensity for you.
Back to our level
Back in the actual level editor you can now go to the browser and drag the sky blueprint into your scene. It won't look like you want yet so open the blueprint, select the static mesh (you renamed sky) and drag your newly created material onto the material slot in the details tab. Save and close the editor. Now your level should be wrapped in a lovely sky sphere, although your level may look dark.
Let there be light
Adding light to the scene can be done a few ways but I personally prefer to do it from within the blueprint, that way I can reuse the whole sky set up if I like.
With that in mind open the blueprint for editing and add a new component. Choose directional lighting and head over to the details tab. Here you can set the intensity, colour and many other attributes. I went for a softer, warm colour to fit the nature of my level but choose what works for you. Save and compile the blueprint, then close it and your level should now look lovely.
If you want to control the orientation and other details from within the level editor you can add a directional light to the scene directly then use the transform widgets to place and rotate.
Next time we will look at adding some more environmental effects, as well as some camera trickery to give a cinematic feel to our levels.
Download Unreal Engine 4
For more from Rob, check out Pariah Studios
Part 1 of the Unreal tutorial series: Setting up a new project
Part 2: Introducing materials and landscapes
Part 3: Adding foliage and rocks
Part 4: Particle smoke