How to use a .exr file as skylight/background?

Nasa provides HDRI images in the .exr format of the actual night sky (of 2020), here.

My question is, how to use that star map as background for my scene?

I’ve seen someone putting a huge sphere around his scene and apply the material, but a SkyLight seems for fitting. A SkyLight expects a CubeMap, though. How do I turn the .exr file into a cubemap?

Also, nasa provides different resolutions: from width (in pixels) = 8192 to 65536. My plan would be to start with the worst resolution and then gradually step up to see if the additional resolution actually results in a better background. But is there a rule of thumb for the resolution of my SkyLight background?

1 Like

You can enable this plugin

1 Like

Thanks

The HDRIBackdrop, just like with the skylight, requires some Cubemap and my imported .exr file is a Texture and can’t be just loaded there.

In order to import a file as a “cubemap” it needs to be a .hdr file. You can convert it in substance designer (and probably photoshop or some other tool)

The engine limits cubemap assets to 2k per side so you probably won’t be able to get more detail than is in an 8k longlat map (like the one you linked)

So what currently seems to work:

Using the nasa image, imported as texture (no mipmap!), I create a material like this

and I tick Two sided and use Shading Model unlit.

I then put a giant sphere mesh around my scene and a apply a material instance and disabled cast shadow.

I don’t know if this is optimal, though.

Also, in order for everything to display correctly, I had to play around quite a bit with the sphere mesh. When I just drag in any sphere from the modeling shapes, the stardome is displayed twice in every hemisphere. When I select the “EditorSphere” as a mesh, everything looks fine. I don’t know what’s the difference between the two.

You can convert from EXR to HDR with Gimp

indeed, that worked.

I converted .exr to .hdr using gimp, than I put the HDRIBackdrop, I set size so big so my scene is included within the HDRIBackdrop and I had to select “SM_SkySphere” as mesh for everything to look nice. Again, there seem to be different ways to build a sphere from polygons or some other thing affecting the display of my texture.

But that’s actually nicer as my custom material as this plugin does all the work for me, including a skylight.

So you’re good to go?

1 Like

yes, problem solved!

1 Like

I apologize for responding to a question that has already been answered. Instead, I’ll suggest a more efficient way I believe in, rather than using GIMP.

I can automate many things using the command-line version of the ImageMagick library.

The latest version that supports HDR can be downloaded from here.

After adding the binary path to the System PATH, I can use it in the command line by typing:

magick input.exr output.hdr