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

Fix OBJ mesh importer smoothing handling #75315

Merged

Conversation

kleonc
Copy link
Member

@kleonc kleonc commented Mar 25, 2023

Fixes #71085.

I thought it was a regression from #68034 so fixed the smoothing logic accordingly. Seems like it does fix #71085, with this PR the MRP outputs (after forcing reimport):

4 vertices, 6 indices
Vertices: 
(1, 0, 1)
(-1, 0, 1)
(1, 0, -1)
(-1, 0, -1)
Indices: 
0
1
2
2
1
3

However, #71085 was reported before #68034 was even merged so that was not really the cause... 🤔 Not sure what was the exact cause back then but seems to work now. 🙃

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I guess the issue was that all flat shaded sections ended up having different smooth groups so they couldn't be merged (even if they had compatible attributes). The update to the API allows you to assign all flat vertices to the same designated group uint32_t(-1) and still keep them flat while also allowing the SurfaceTool to merge them.

@akien-mga akien-mga merged commit ee0e809 into godotengine:master Apr 13, 2023
@akien-mga
Copy link
Member

Thanks!

@kleonc kleonc deleted the obj-importer-fix-no-smoothing-handling branch April 13, 2023 09:56
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.0.3.

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

Successfully merging this pull request may close these issues.

Flat-shaded OBJ mesh is imported with more vertices in Godot 4
4 participants