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

Shading errors on gltf imports #83345

Closed
Faradax opened this issue Oct 14, 2023 · 7 comments · Fixed by #88738
Closed

Shading errors on gltf imports #83345

Faradax opened this issue Oct 14, 2023 · 7 comments · Fixed by #88738

Comments

@Faradax
Copy link

Faradax commented Oct 14, 2023

Godot version

v4.2.beta1.mono.official [b137180]

System information

Godot v4.2.beta1.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.3699) - Intel(R) Core(TM) i9-9900 CPU @ 3.10GHz (16 Threads)

Issue description

I'm using blender to export assets as gltf. When importing gltfs into Godot 4.2, I observe shading issues where parts of surfaces are darker or lighter in odd spots.
As a minimal example, I can even reproduce this with blenders "default cube" as it appears at the startup of the application without any modifications to either mesh or material. Checking "Data>Mesh>Tangets" on export does not affect the outcome.

In the following two pictures, the left cube is the imported blender default cube, the right one is a MeshInstance3D with a 2x2x2 BoxMesh for comparison.

v4.2.beta1.mono.official [b137180]
image

When I import the same gltf in v4.1.1.stable, the result looks correct, so I assume this to be a regression:
v4.1.1.stable.mono.official [bd6af8e]
image

Other simple examples of some subdivided/beveled cubes, as seen in the "Advanced Import Settings" dialog in v4.2.beta1.mono.official [b137180]:
image
image

Steps to reproduce

  • Export blender default cube as gltf
  • Import in v4.2.beta1.mono.official [b137180]

Minimal reproduction project

N/A

@clayjohn
Copy link
Member

Can you try reimporting with force disable compression enabled in the import settings?

@Faradax
Copy link
Author

Faradax commented Oct 14, 2023

Enabling the "Force disable compression" option gives this difference (left with option disabled, right with option enabled):

v4.2.beta1.mono.official [b137180]
image

So it does indeed seem to prevent this issue.

@stevenctl
Copy link

stevenctl commented Oct 15, 2023

Force disable makes a difference, things still look odd.

Edit: it must be due to some weird geometry (procgen in blender -> gltf -> godot)

Screenshots

Force disable off:

noforcedisable

Force disable on:

forcedisable

Here's 4.1.1

orig

The wireframe of one of the messed up meshes:

wire

@clayjohn
Copy link
Member

@stevenctl are you able to share that mesh?

@stevenctl
Copy link

bugmesh.zip

Looks like verts are duplicated on export from Blender. Trying to merge vertices and re-export/import yields the same separation of verts. Importing to 4.1.1 looks ok though.

@Faradax
Copy link
Author

Faradax commented Oct 15, 2023

For the mesh @stevenctl provided, I get a correct-looking import if I disable "Ensure Tangets". "Force Disable Compression" doesn't affect the result after that.

@lyuma
Copy link
Contributor

lyuma commented Dec 24, 2023

Is this the same issue as #84270 ?

Is this fixable in cases of incorrect normals or are we hitting some limit of mesh compression?

Also, is there a way to detect that we have significantly distorted normals with mesh compression and warn the user, disable compression or fail the import in such cases?

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

Successfully merging a pull request may close this issue.

5 participants