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

LDrawLoader: Make normal smoothing condition more explicit #23093

Merged
merged 1 commit into from
Dec 27, 2021

Conversation

gkjohnson
Copy link
Collaborator

@gkjohnson gkjohnson commented Dec 26, 2021

Related issue: Fixed #23085.

Description

Previously some primitives were getting smoothed multiple times due to the labeling of the file include hierarchy. This changes the condition for when the face normals are smoothed to be more explicit -- either when when a "Part" is being finalized or a set of faces (a "Primitive" type) is being added directly into a "Model" type.

Unfortunately the LDraw spec seems to be pretty vague when it comes to what "types" are valid (or the files are just a bit loose with them). In the case of the car model there was an extra type called "Configuration" that was triggering a extra "smooth normals" step with the previous condition which resulted in incorrect normals.

Here's the example page with the fix:

https://raw.githack.com/gkjohnson/three.js/ldraw-black-bit-fix/examples/webgl_loader_ldraw.html

Notice the black spots on the car model are fixed and the ribbed pipes and blue rubber band inside the model in the AT-ST file are smoothed correctly, as well (which was the original intent behind the condition).

Happy holidays!

@Mugen87 Mugen87 added this to the r137 milestone Dec 27, 2021
@Mugen87 Mugen87 merged commit 70ab013 into mrdoob:dev Dec 27, 2021
@gkjohnson gkjohnson deleted the ldraw-black-bit-fix branch December 27, 2021 16:16
@mrdoob
Copy link
Owner

mrdoob commented Dec 27, 2021

Thanks!

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

Successfully merging this pull request may close these issues.

webgl_loader_ldraw.html has strange "black piece".
3 participants