Download

Normal map loaded through "Download Image" looks incorrect

Hi all, I’m new to Unreal and blueprint scripting, and I’m trying to do a tool to configure an appartment, in which you can change the material of the floor, wall, etc on the fly, loading materials in REST from a json description that we’re already use in another version of the configurator (WebGL based), that will then load the textures via the “Download Image” blueprint node, and apply them to a material that is then used on the mesh.

It seemed to work allright, until I noticed the lightmaps look all funky on the meshes that have a material loaded from that blueprint. I traced it to the normal being the culprit, and then discovered that the normal has 0 red and green channels, and the blue channel is like a bumpmap version of the normal.

Loading the same texture in the assets and using it on a material works fine. Only when I load it with Download Image from the blueprint at runtime it produces this result…
I tried setting the texture compression to “Normalmap” after loading it, but it doesn’t make a difference.

tl;dr: normal map loaded with “Download Image” blueprint node has an empty red and green channel, and a bumpmap version of the normal on the blue channel. What do ?

The default normal map handling in the engine uses normal map compression, where du/dv are encoded and the “z” part of the normal are reconstructed (if I remember correctly – something like that.)

To make downloadable textures “in general” work, you’ll have to read the texture using a sampler that is not in “normal map” mode, and you’ll have to do whatever you need to do to create a proper normal out of it, and plug that into the “normal” material output. You also should turn off sRGB from that sampler.

This means that the default texture parameters also need to be in the “download” format, not the in-engine “normal map” format.

Yep, I figured on my own that sRGB was the culprit, I compared a regular diffuse texture and a normal map texture to see what difference they had and sRGB was not ticked on the normal. It works fine now, thanks !