Make a space skybox with Spacescape and use it in UE4

In this post, I will explain how the skybox in Hexode was made. I used an open source tool called Spacescape, developed by Alex Peterson. This tool can generate procedural space skyboxes, using noise functions. The nice thing about it is that you can achieve a pretty good result in a limited amount of time.

Playing with spacescape

I am not going to make an extensive tutorial on Spacescape itself as there are enough learning resources on Alex’s website. I’ll give an example instead. I wanted to make purple-ish space background with nebulas and bright stars. It may be a little too colorful but I wanted to differentiate a bit from what we tend to see in space games. Here is the save file:

Integration with UE4

This is not so straightforward. The first step is to import the .dds into Unreal (right click in the content browser and select import). Depending on the size of the texture, this may take quite some times. It took me several minutes to import a 2048×2048 version of my purple nebula background. Unreal seems to be completely frozen while doing that by the way, so don’t be surprised if it happens to you.

Once imported, double click on the texture and adapt the compression values. There is no magic recipe here, you have to test what gives the best results for each skybox. I have highlighted what I changed in this example.

skybox_import_settings

Next, create a new material, whatever the name, and add these nodes:

skybox_material

The divide value is here to help adapt the brightness. It is set as an instance parameter to be easier to tweak.

Be sure to configure those two properties as shown in the screenshot.

skybox_material_details

Create an instance of the material. Then create a new Blueprint actor and put an instance of it in the map. Add a static mesh component (called SkySphere in the example bellow). Go to the construction script and copy the graph. Basically, you just set the material and pass the material instance in the parameter.

skybox_bp

 

That’s it, you’re done ! The skybox should appear in the view port.

Conclusion

Adding a skybox is not really intuitive and there may be easier way to do it but I am pleased with the result. I really like the material system in UE4, though I don’t understand all of it yet. But at least it offers you to tweak properties without having to change the base texture itself. It is a really powerful tool.

 

The dev.

3 thoughts on “Make a space skybox with Spacescape and use it in UE4

Leave a Reply

Your email address will not be published. Required fields are marked *