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

PolyhedronGeometry: Compute flat normals when detail is zero #11330

Merged
merged 2 commits into from
May 14, 2017

Conversation

WestLangley
Copy link
Collaborator

Previously, smooth normals were computed all the time.

However, flat normals are more appropriate when the detail parameter is zero, resulting in a regular polyhedron.

When detail is greater than zero, the geometry is tessellated. Personally, I think flat normals are more appropriate in that case, too. However, I believe some users are using IcosahedronGeometry as a stand-in for a sphere, and would object to the change. Consequently, this PR retains smooth normals when detail is non-zero. I do not see the point in adding an optional flag.

/ping @Mugen87

@Mugen87
Copy link
Collaborator

Mugen87 commented May 13, 2017

However, I believe some users are using IcosahedronGeometry as a stand-in for a sphere, and would object to the change.

Yeah, i've often seen this. I think it's called an icosphere.

I'm fine with this change.


if ( detail === 0 ) {

BufferGeometry.prototype.computeVertexNormals.call( this ); // flat normals
Copy link
Collaborator

@Mugen87 Mugen87 May 13, 2017

Choose a reason for hiding this comment

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

Just for my understanding 😇 : Why not this.computeVertexNormals()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Thanks.

@WestLangley
Copy link
Collaborator Author

Yeah, i've often seen this. I think it's called an icosphere.

And it appears to have flat normals -- even at higher detail.

@WestLangley
Copy link
Collaborator Author

BTW, I think the UVs for DodecahedronGeometry are messed up at detail level zero.

@mrdoob mrdoob merged commit bbcc412 into mrdoob:dev May 14, 2017
@mrdoob
Copy link
Owner

mrdoob commented May 14, 2017

Thanks!

@WestLangley WestLangley deleted the dev-poly branch May 14, 2017 01:46
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.

3 participants