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

Fixes the normals of SphereMesh when the sphere/hemisphere is oblong #51995

Merged
merged 1 commit into from
Aug 25, 2021

Conversation

drcd1
Copy link
Contributor

@drcd1 drcd1 commented Aug 22, 2021

Fixes #49861

Basic logic (in 2D) is that if (a,b) is a normal, the corresponding tangent is (b,-a). If the object is scaled along the y axis, the tangent becomes (b,-a*scale). The normal to this tangent is therefore (a*scale, b).

@Calinou Calinou added bug topic:3d topic:core cherrypick:3.3 cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Aug 22, 2021
@Calinou Calinou added this to the 4.0 milestone Aug 22, 2021
@fire fire requested review from a team and JFonS August 22, 2021 21:50
@JFonS
Copy link
Contributor

JFonS commented Aug 25, 2021

I haven't double-checked the math, but assuming it's correct, do we need to fix tangents as well?

@drcd1
Copy link
Contributor Author

drcd1 commented Aug 25, 2021

I haven't double-checked the math, but assuming it's correct, do we need to fix tangents as well?

In this case, the tangents are orthogonal to the scaling axis (i.e.: parallel to the xz plane) so they don't change when you scale along the y axis.

Copy link
Contributor

@JFonS JFonS left a comment

Choose a reason for hiding this comment

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

the tangents are orthogonal to the scaling axis

Right, that makes sense :)

Math looks good, should be ready to merge.

@JFonS JFonS merged commit 353bb45 into godotengine:master Aug 25, 2021
@akien-mga
Copy link
Member

akien-mga commented Sep 13, 2021

Cherry-picked for 3.4.

Edit: Reverted cherry-pick due to regression: #52965.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Sep 13, 2021
@akien-mga akien-mga added cherrypick:3.x Considered for cherry-picking into a future 3.x release and removed topic:core labels Sep 23, 2021
@akien-mga
Copy link
Member

Cherry-picked for 3.4. (Together with #53154.)

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Sep 29, 2021
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.

SphereMesh normals are incorrect if the radius is not equal to the height
4 participants