glTF-Blender-IO
glTF-Blender-IO copied to clipboard
Normal Maps Export Incorrectly
Describe the bug
The normal map is not exported correctly with the model provided in the file. When you export and import the model back you can see the incorrect normal map. After import, on changing the mode of Color-Space from Non-Color ( Correct ) to sRGB ( Incorrect ) in the Normal texture node
the rendering results become correct !?
To Reproduce Steps to reproduce the behavior:
- Go to Shading tab and see the correct normal map and its settings
- Click on File->Export->gltf2
- Select Format type : gltf Binary
- In Include , select the selection "Selected Objects"
- In Transform, select +y option
- In geometry select UV and NORMALS
- In animation do not select anything.
- Name the file anything and save.
- Import back the saved file
- Go to the shading tab and you will see the model imported with incorrect normal.
Expected behavior The normal map should behave correctly in Non-Color mode after import
Screenshots
You can see the incorrect import and the original correct model with the same shader graph
.blend file/ .gltf link to file : https://drive.google.com/file/d/1WE5Ku22UWeTxKJu46uUnHVaYjxjmuYTf/view?usp=sharing
Version
- OS: Windows 10
- Blender Version : 2.93.4
- GLTF Exporter Version : Default 1.6.16 and Latest 1.17.30
Hello, Display is OK with online viewer https://gltf-viewer.donmccurdy.com/ Seems the problem come from importer, not from exporter. Can anyone confirm?
The exported .glb
does show this issue, it's subtly visible as a seam on the front of the shoe in my viewer:
I'm pretty sure the problem is related to the normal map being a .exr
image. I'm not too sure how those files work, perhaps something (either in this addon or in Blender?) is doing an unwanted linear -> sRGB conversion when exporting the image?
If I manually export the normal map as a PNG and then drop it into the file, things look fine:
before | after |
---|---|
![]() |
![]() |
Aside – it's generally a good idea to include vertex tangents in the export when debugging a normal map issue, but that doesn't seem to have been the cause here.
@donmccurdy I was having this very same issue a couple of days ago, and converting the EXR to PNG in Blender solved the issue indeed.
can confirm this issue with most models from polyhaven as they use exr as default texture format for the models
eg: https://polyhaven.com/a/drawer_cabinet
the normal map texture seems to be exporting in linear color space instead of sRGB
Before
After changing the normal map's color space from 'non-color data' to 'sRGB'
Is this correct ?
we are having this issue as well. it appears the exported normal maps are being exported in the wrong color space. the source map is correctly set to non-color. but when you import the file the normal map color is wrong and you get the faceting issue. to resolve it you need to set the normal map image to srgb. not sure how to properly resolve this.
follow up, it appears this is fixed in blender 3.3
Yes, I just tested with 3.3.1 released today, and problem is now solved. Closing