[SOLVED] How do I import a .png as a cubemap

[SOLVED]

This issue has been solved by both **Arkiras and NotSoAccurateNo1 **in two different methods, if you’re having the same issue, check out their messages below. Feel free to revive this thread with new comments, but don’t expect new responses.

[ORIGINAL POST:]

I want to import cubemaps I rendered out in blender into unreal, but I can’t for the life of me figure out how I get from a .png image that blender exports to the very specific kind of .dds that UE4 asks for. I’ve tried the ATI tools, which only give me coloured cubemaps and I can’t figure out how to export my .png cubemap instead of the placeholder colours and the NVIDIA tools won’t let me import my cubemap as a cubemap and just completely remove the option of exporting it as one.

Here’s an example of a test cubemap I’ve rendered out:

Ah yes, another poor soul discovers that working with Cubemaps in UE4 is absolutely terrible. We can convert a regular texture to a volume texture or a virtual texture but lord help us if we want to make a regular texture into a texture cube.

In order to import a Long/Lat cubemap like yours you have to import it as an hdr file. How do you get a .hdr file? Well therein lies the dilemma because it seems most image editing software will not save to this. Photoshop might, but I don’t have that. What I do have though is Substance Designer, which will also save an HDR:

Once you’ve got your .hdr file and you’ve imported it to UE4 you’re going to notice a number of immediately obvious problems.

  1. Because UE4 is expecting an HDR image and your image is an 8bit PNG, the colors will not be correct. You can compensate for this a bit by setting the brightness curve on the texture asset to 2.2
  2. The cubemap resolution will be noticeably worse than your import resolution. It won’t display higher than 1024x512. You can adjust the max texture resolution but be brace yourself, the memory consumption will be ridiculous. I don’t recommend going to 4k with this and I would urge you to use a different compression setting than default HDR.

If it is an option for you then I would strongly suggest you generate your cubemaps from inside UE4, using the Capture Cube actor and a render target.

5 Likes

I couldn’t really figure out how to do that, but after clearing my head a bit and this rather simple explanation I finally get it! I’ll do that, so the cubemaps will match the graphics of the game. Thank you very much for your help!

For simple cubemaps, like what you rendered in blender, you can render them in ue4 with a captureCube component.

  1. add a captureCube to the world or to an actor blueprint.
  2. add new renderTarget cube for the captureCube
  3. then you rightick the rendertarget and save as static texture.

You can also convert jpg to cubemap by adding a uv sphere around a capturecube. Material has to be 2 sided. The material shading model set to unlit. texture plugged into emissive.

2 Likes

Guys, you can use this page to convert any img file to hdr, i tested and worked pretty fine

https://convertio.co/

6 Likes

OMG thank you! I was using other software to convert to HDR but it didn’t import as a cubemap to UE4. This one does so thank you for pointing it out and thank you convertio!

Just stumbled across this post and it really helped me out - thanks in particular for that link Franadoriv

Just want to add an additional option for people who are trying to figure this out so that they can use the cubemap in their materials: Unreal has a built-in LongLatToUV function which will allow you to sample a regular texture using a vec3, as if it were a cubemap.

For other things such as using a cubemap in the skylight or a reflection capture, you’ll still need to import an HDR.

4 Likes

I’ve also since discovered that Photoshop will save as an HDR that will import to UE4. You just need to convert the image to 32 bit and then when you save, the file type is called Radiance. This will let you save any image to hdr that will import to UE4 as a cubemap.

3 Likes

Material Domain? Blend Mode? Shading Model?.. thx!!

1 Like

Really doesn’t matter, use whatever is suitable for the material you are building.

In my case I just used unlit opaque because it compiles the fastest, but that would also probably be ideal for a skydome material.

1 Like


when i try to replicate your nodes I get this error… any clue?

Looks like your texture sample already contains an hdr cubemap, you don’t need to use LongLatToUV in that case