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

ExtrudeGeometry: Improve Default UV Generator #21875

Merged
merged 1 commit into from
May 24, 2021

Conversation

codrakai
Copy link
Contributor

@codrakai codrakai commented May 22, 2021

Related issue: #4994

Description

Per the linked issue, some surfaces in extruded geometry would have default generated uv coordinates such that their textures were stretched. This was a result of having two uv mapping schemes—one for surfaces close to vertical, one for surfaces close to horizontal—and using the vertical mapping for all but the most horizontal of surfaces.

This change increases the quality of the default mapping by using the horizontal mapping scheme in more cases. We determine whether to use the vertical scheme or the horizontal scheme by taking the angle between the up vector and a segment in the generated extrusion surface. When the angle is less than 45 degrees, we treat it as mostly vertical; when it is greater, we treat it as mostly horizontal. We then apply the matching scheme.

Borrowing the images that @WestLangley kindly submitted to illustrate the difference, we have the before:

Screen Shot 2021-05-21 at 10 54 30 PM

And the after:

Screen Shot 2021-05-21 at 10 54 30 PM

@codrakai codrakai force-pushed the fix/extrude-geometry-default-uvs branch from c33ec60 to 8d72553 Compare May 22, 2021 16:40
@WestLangley WestLangley changed the title Map more surfaces as horizontal-like ExtrudeGeometry: Improve Default UV Generator May 22, 2021
@codrakai codrakai force-pushed the fix/extrude-geometry-default-uvs branch from 1a94ea6 to f330c70 Compare May 22, 2021 22:51
@WestLangley WestLangley added this to the r129 milestone May 22, 2021
@mrdoob mrdoob merged commit 71c8b3f into mrdoob:dev May 24, 2021
@mrdoob
Copy link
Owner

mrdoob commented May 24, 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.

4 participants