-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Mesh LOD merges flat-shaded vertices together with smooth-shaded vertices #103722
Comments
This is caused by mesh LOD merging vertices together and using smooth shading in the process (presumably for performance reasons). smooth_shading_lod.mp4This issue is not present in 4.3, most likely because it uses an older version of meshoptimizer with different optimization. If you disable Meshes > Generate LOD on the Import dock on the 3D scene in question, the issue will go away. Normal buffer comparison:
@HaroldH76 Can you try following the same steps on 4.4 dev/beta/RCs to determine when the regression started? You can download them here. |
Thanks for the bisecting help 🙂 This changelog includes #98529, so there's a fair chance it's related. I'll bisect this just to make sure. |
The LOD generator in Godot has always (edit: well, since like 4.1? it's been a while) welded vertices with similar normals before simplification before passing it to the simplifier. So I'm surprised this ever worked on 4.3; maybe because the attribute metric was not working as well, the simplifier for some reason was hesitant to merge these specifically. I assume it's just a happenstance, for example maybe the edges of the object were locked and the object is so low-poly that all edge collapses were prevented before the update due to extra topological restrictions that were lifted. This is controlled by the "normal angle" threshold in import settings. Setting that to 10 (from default 60) fixes this specific example. I'm not sure it's realistic to expect the simplifier to preserve the facets with the setting set to an angle that exceeds the angle between faceted triangles in a given model, because it's literally instructed to simplify from a welded model, and any collapse around the welded region will effectively change the shading. If faceting needs to be preserved exactly, the setting should be set to a very low value (which obviously limits simplification to only flat areas, but such is life...). |
Tested versions
System information
Windows 11 -Godot v4.4stable -Vulkan(Forward+) -dedicated NVidia 2070 Super (laptop)
Issue description
I have a game in which I like everything flat shaded (low poly design). When I upgrade the game from 4.3 to 4.4 then some models are not flat shaded anymore. I use no special shaders. Just a Blender model and in Blender I set it to flat shading and then I export it as glb file.
See screenshot for the difference in the green model.
See attached zip for a 4.3 and 4.4 project: godot43-44.zip
Also this might be related to this issue: #103675 ?
Steps to reproduce
Minimal reproduction project (MRP)
See attached zip for a 4.3 and 4.4 project: godot43-44.zip
The text was updated successfully, but these errors were encountered: