We have a Gift for You, a FREE SCENE. Happy Christmas!

DOWNLOAD NOW
Search
Cart
Sign in
  • offerCustomer zone
  • offerYour orders
  • offerEdit account

  • offerAdd project
  • offerLiked projects
  • offerView your artist profile

  • Dark mode

We care about your privacy

We use cookies to provide you with the best possible experience. They also allow us to analyze user behavior in order to constantly improve the website for you. The consent is voluntary. You can withdraw it at any time or renew it in Cookie settings on the home page. Withdrawal of your consent does not affect the lawfulness of processing performed before the withdrawal. Privacy Protection Policy
Accept all
Accept selection
Reject all

Creating custom sky from HDR image in Unreal Engine

Michał Franczak 2017-06-29 11:08 tutorial  > Unreal Engine  > modeling

Use cubemaps to create custom sky in Unreal Engine 4.

If you are making visualizations in Unreal Engine, you can base on default blueprint BP_Skysphere that provides clouds, different sky colors and daylight variations. If you think it is limiting, you can also use some blueprints from Unreal Marketplace, like Ultra Dynamic Sky by Everett Gunther (but it costs over $34).

Here it is in action:

 

But, assuming you made some architectural visualizations in the past, you probably have some nice HDR images on your hard drive - and you could use them as your sky also. The problem is that they are mostly panoramic images in equirectilinear projection. And Unreal can map them on a sphere, but if you want to match lighting and environment in the best possible way, you will need a different format - a Cubemap as DDS file.

From Unreal Engine Documentation we can read that Cubemaps provide a simple method of environment mapping, in which distant scenery - such as skies and surrounding environments - is mapped to a panoramic texture. Under the hood, these textures are stored as a series of six images mapped to the inside faces of a cube.

In this tutorial I will show you a simple method to create cubemap from your HDR images. 

First, find some nice HDR image, I use some industrial interior for this tutorial. It looks like that: 

hala_hdr

Original is in HDR format, 8000 pixels wide.

Now we need to make a cubemap out of it. There are several programs that can do that. I found that one of the easiests ways is to use Blender for that!

slice1_3

Open Blender and load this file. It is a simple scene with a single camera and six frames. In each frame the camera rotates and takes one shot of a part of a sphere that it's outside of it. This scene is based on a file prepared by coldacid for his tutorial. I modified it a bit to match Unreal needs.

slice2_3

As you can see, there is a sphere inside that has shadeless material assigned. We need to change the texture of this material

 

slice3_3

We load our HDR file

 

slice4_3

It's now in the slot

 

slice5_3

If we want to use some JPG or PNG environment map, we can use PNG output, but in our case we are using HDR image, so in Render Settings we choos Radiance HDR.

 

slice6_3

...and RGBA mode. Then we can press "Animation" on the top of Rendering panel. Blender will render six frames. Each frame will have a rotation that is accepted by Unreal. They will be rendered as this:

CubeMapNvidiaLayout

Cubemap layout.

 

slice7_3

Before we will open them in Photoshop, we need Nvidia Texture Tools for Adobe Photoshop. They are free to download. After you install them, you can open Photoshop and you will have new "Save as" option - DDS file. So now go ahead and open your six files.

 

slice8_3

Go to the first file and open Canvas window (CTRL-ALT-C by default). We need to place all six images in one so we choose "600 percent" and press left arrow to move the existing content to the left.

 

slice9_3

Paste the rest five images in the sequence from left to right.

 

slice10_3

Now you can save as DDS

 

slice11_3

Nvidia plugin window opens and you can choose 8.8.8.8 32 bit unsigned RGBA preset

 

slice12_3

Let's go to Unreal! First, make sure that you can see Engine Content in your browser.

 

slice13_3

Create a blueprint (Actor), name it "SkySphere_BP"

 

slice14_3

First, add mesh, name it SphereSky, go to Static Mesh browser and select SM_SkySphere, then add a Variable and name it SkyMaterial.

 

slice15_3

Go to construction script. Your variable type should be "Material". Drag a line from your "Construction Script" node and select "Set Material (SphereSky)". Attach your variable Sky Material (GET) to Material input. Make your Sky Material variable public so you will be able to change your cubemaps in the future.

 

slice16_3

Import your DDS file - it does not have the right colors and sharpness, we need to tweak some settings.

 

slice17_3

Use "UserInterface 2D compression, uncheck "sRGB" checkbox and choose "NoMipmaps" in Mip Gen Settings.

 

add1

Now.let's create a material for our sphere. Use this nodes - 3-Vector goes to ReflectionVectorWS that goes into Texture Sample Parameter Cube. Select Texture Sample Parameter Cube node and select our DDS file. Then add Divide node and 1-vector as a "B" input. Connect to Emmisive slot. Material should be set as unlit, two-sided.

 

add3

Place our blueprint in the scene, center it and assign material to it.

 

slice18_3

Now our interior looks correct!

 

slice19_3

Create a skylight, select "SLS specified cubemap" in Source Type and select your cubemap. This way Skylight will be using your cubemap for lighting the scene.

That's it! Thanks for reading, hope you like it! :)

Author: Michał Franczak Editor: Michal Franczak
Tags: unreal environment cubemap
You may also like...
Unreal Engine  - free direct access for students

Unreal Engine - free direct access for students

Unreal Engine 4 is now free for students through Github.
×

LEAVE A COMMENT

You need to be logged in to leave a comment. Don't have account? Register now.

mikekaliven87 16:17:46  |  30-06-2017
Really great lesson)
Natural Warp 13:33:11  |  27-01-2018
Hi, i'm absolutely new to unreal engine and i'm stuck with the part that should result in the 1 node Then add Divide node ( that worked ) and 1-vector ( no idea where to get the 1-vector ) as a "B" input. do please help ! THX great article btw !! would love to succeed on this one ! G.
Natural Warp 13:56:35  |  27-01-2018
guess i found it, under 'constant' with the value of '1' now i just need to get the texture right since it's giving an error on the 'Texture Sample Parameter Cube'
lanfranconi 11:48:27  |  10-03-2019
is this still the way to do it in 2019? i would be thankful if you guys could archive tutorials that are outdated, its very confusing. UE4 is not able to import any .DDS files, so I don't know why this is mentioned here?