Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.2 Beta 3 Mesh Compression Alters Models and resulting texturing #84270

Closed
Adeering opened this issue Oct 31, 2023 · 2 comments · Fixed by #88738
Closed

4.2 Beta 3 Mesh Compression Alters Models and resulting texturing #84270

Adeering opened this issue Oct 31, 2023 · 2 comments · Fixed by #88738

Comments

@Adeering
Copy link

Adeering commented Oct 31, 2023

Godot version

4.2 Beta 4

System information

Windows 10

Issue description

When importing models with mesh compression on there are artifacts created that affect the texturing and look of the models. In the Minimal Reproduction Projects attached, I have the same model imported in 4.1 and in 4.2 to show the difference between the imported models. While troubleshooting, it seems the model scale can be a contributing factor (as this models default scale was 0.01 in blender). However, this does not happen in 4.1 or when mesh compression is disabled.

image
4.1 on the left, 4.2 with compression on the right

Steps to reproduce

Import a mesh and create a new inherited scene to view it (does not need a texture to notice issue). Go to import settings and select "Force Disable Compression" under Meshes and reimport it removes the issue.

Minimal reproduction project

GodotCompressionMVP.zip

@Adeering
Copy link
Author

After some troubleshooting with some other godot users. Narrowed it down to the glb/gltf file based on blender version. When the model in the MRP is exported from Blender 3.2.1 Godot Mesh Compression causes those artifacts. But when the same model is exported from Blender 3.6.2, then Godot Mesh Compression does not cause any artifacts. I hope this helps narrow down the possible culprit so older glb/gltf files still work with Mesh Compression as expected

@clayjohn
Copy link
Member

clayjohn commented Nov 1, 2023

The issue here is that mesh compression relies on having valid tangents.

In the importer we can generate tangents based on normals and UVs if the "ensure_tangents" box is checked off.

This model contains UVs, but the UVs don't contain valid UV data, so the generated tangents are bogus. When they get passed to the renderer, the renderer creates invalid normals. The current solution is to either uncheck ensure_tangentss or check force_disable_compression.

I'm investigating whether we can do something more and detect these cases. We might be able to check for bogus UVs and then fallback to a different method of generating tangents (the same as what we use when UVs aren't present)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants