Closed Dabnabbit closed 2 years ago
Can you reproduce this in 3.5.1 (in GLES3 at least, ideally also GLES2)?
@Calinou Hey that's a great point! I didn't isolate out a few more variables here, for clarification, that was utilizing 4.0.beta3 Vulkan rendering using the .blend file native support, I'm gonna go back and double check with .glb format as well, but that said, I can NOT currently reproduce this issue in 3.5 GLES2 or GLES3, verified checking both with the same mesh imported in glb format, the normals are behaving as expected! The normal maps are being rendered correctly here.
[update:] Just verified that it apparently has more to do with the new .blend support than normal maps, so this ticket is not completely accurate anymore. ![Uploading image.png…]()
Here in 4.0.beta3 you can see the exact same mesh in .GLB and .BLEND formats, with the exact same ![Uploading Screenshot 2022-10-18 101813.jpg…]() normal map texture applied through the exact same material file to both meshes.
Ok, I figured out what is causing the issue on .blend mesh imports, this is specifically due to the 'Tangents' flag being set on import for the meshes. Disabling the Tangents import flag seems to resolve the issue. So now I'm no longer sure this is actually a bug or not? Still seems weird that there doesn't seem to be control over the texture color-space but I might just be looking at this whole thing wrong.
In this case, I don't think the issue is the normal map's color space.
.blend
import internally calls Blender's glTF export, but it may be using different options than what you're using in Blender's GUI.
cc @fire
Tangents being broken in import between different pipelines is a thing. @julienduroure Any ideas how to debug this, the first guess is we imported the tangents wrong.
Maybe linked to this : https://github.com/KhronosGroup/glTF-Blender-IO/issues/920
@Calinou thanks for the title update/corrections, was considering making a new ticket more correctly identifying the issue, after some more diving into the issue, I think I have actually identified the issue has being a blender GLB export issue rather than a Godot issue! Attempted a re-install of a different version of blender to test the export flags (which do include the same options as Godot's import options) and found that the tangent flag was not being properly disabled or enabled in Blender, so GLB files were all being exported without tangents, and .blend files were all exporting WITH tangents.
I think it's actually safe to close this one, however, I might recommend disabling the import tangents option by default in Godot, as it doesn't seem to be beneficial in any use cases I've seen so far. (still testing)
I was able to reproduce the broken tangents by ensuring the "Export tangents" option was checked in the working Blender export: confirming the issue... so at least it's debugged for now, I've seen a few other posts about 'latest' Blender builds causing some issues with Godot but it sounds like more and more of them are Blender problems than Godot problems.
Thanks for looking into the issue either way guys, you all rock! (maybe disable tangent imports by default though)
however, I might recommend disabling the import tangents option by default in Godot, as it doesn't seem to be beneficial in any use cases I've seen so far. (still testing)
Some glTF scenes downloaded online may not include tangents in them, so the option is required for normal mapping to look correct on them. Not everyone is authoring the 3D scenes they're using in their project :slightly_smiling_face:
however, I might recommend disabling the import tangents option by default in Godot, as it doesn't seem to be beneficial in any use cases I've seen so far. (still testing)
Some glTF scenes downloaded online may not include tangents in them, so the option is required for normal mapping to look correct on them. Not everyone is authoring the 3D scenes they're using in their project 🙂
Good point, guess I forget sometimes about the pre-existing assets coming in different forms.
I have the same issue. Tried Blender 3.1 and Blender 3.3.1 and both failed. I have first encountered this bug in Godot4.0 Alpha 15 and i still have it in Godot4.0 Beta 4. Alpha 14 is working fine. Different export flags or different file format won't change anything.
Alpha 14:
Alpha 15 to Beta 4:
Keep in mind that it is NOT the whole Normalmap that is displayed wrong. It's always just certain parts of the mesh.
If it started with Alpha 15, it's likely related to octahedral compression. Likely will be fixed by #68428
@Eisendroid if the issue started in alpha 15, it should go away when you re-import your mesh. You can do that in two ways. One is to delete the .Godot folder in your project's folder. The other is to select the mesh in the editor, then in the import tab select re-import
@Eisendroid if the issue started in alpha 15, it should go away when you re-import your mesh. You can do that in two ways. One is to delete the .Godot folder in your project's folder. The other is to select the mesh in the editor, then in the import tab select re-import
Re-import in Alpha 15 fixes some graphical glitches, but the problem with tangents/normalmap stays the same. I hope Zireael07 is right and it's related to octahedral compression, so it's almost fixed already.
Godot version
4.0.beta3
System information
Windows 11, RTX 3070TI, Vulcan
Issue description
[UPDATE 2: This issue is specifically due to enabling the 'Tangents' flag (enabled by default) on the import options for .blend files, this flag does not appear to be available for other mesh formats, so I'm researching exactly what it's trying to do]
[!!!UPDATE!!! This issue is apparently exclusive to the .blend mesh format, it does not appear to be affecting meshes in .GLB format]
After trying to figure out why some models looked wrong for many days I finally figured out what was wrong. The normal maps are currently only represented in SRGB colorspace, which is inherently wrong for most modern render pipelines, which utilize 'linear colorspace' aka 'noncolor data' for vector space maps that are not meant to represent visual data, i.e. normal maps (this likely also affects other data texture maps) Here are some images representing and reproducing the issue outside of Godot in Blender: and fixed by changing the colorspace to "non-color" data format: and doing some research on the topic I stumbled on this weird 'hack' by utilizing a Gamma node in blender to convert the sRGB colorspace into 'close-enough' linear "non-color" representation of the normal maps... for whatever reason someone discovered altering the Gamma of the sRGB color space by a value of 0.454 very closely simulates the true vector linear color-space... go figure?
Finally here is the same issue displayed in Godot with the exact same assets: Shouldn't have to draw lines on that one to show the issue/errors... This particular asset GREATLY exaggerates the flaw in the system due to the high number of mirrored UVW coordinates utilized across multiple axis, and normally with a diffuse texture and specular textures on a mesh you won't quite notice them as strongly as you do here where the asset is stripped to only the normal map. Just for added clarity, I've also attached a screenshot of the mesh with NO normal map applied to demonstrate that the mesh itself is not causing the seams, i.e. broken welds/vertices:
Another more subtle but still very broken example of a different asset:
This issue CAN be avoided by uniquely mapping every UVW space and avoiding any seams across flat surfaces, however, that is a huge cost to pay in the development pipeline in terms of time and also pixel real-estate.
Ultimately this is just aesthetic, but a huge factor in why high quality asset production in Godot just isn't quite matching up to other engines the way it should be.
[UPDATE] Here is a comparison of .GLB and .BLEND mesh formats using the same normal map texture, same mesh, and same material:
Steps to reproduce
Load minimal reproduction project, witness normal map errors on mesh, there are no options to correct this or change the colorspace of imported normal map textures (or any other textures).
Minimal reproduction project
[UPDATED: Updated MRP with both .blend and .glb mesh formats side by side in main scene] NormalMapBug.zip