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

Feature request: Connected outlines for flat-shaded faces #1259

Open
mattrossman opened this issue Aug 2, 2023 · 1 comment
Open

Feature request: Connected outlines for flat-shaded faces #1259

mattrossman opened this issue Aug 2, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mattrossman
Copy link
Contributor

mattrossman commented Aug 2, 2023

When loading a model with flat-shaded faces, outlines appear disjoint:

This matches the behavior in UniVRM and the Blender VRM add-on, however it's not always desirable for artists.

Blender's glTF exporter (and perhaps other exporters?) exports flat-shaded geometry with non-shared vertices. For example, exporting the default cube (8 vertices) yields a glTF model with 24 vertex position vectors. I'm not sure the exact reason, but I assume it's so that it can include normals data for these verts to ensure they appear flat in other renderers.

I would like the VRM loader to have an option to intelligently recalculate normals for the outline geometry so that these overlapping vertices appear connected.

I think this can be achieved with the help of THREE.BufferGeometryUtils.mergeVertices() and THREE.BufferGeometry.calculate.vertexNormals() inside the VRM loader, and perhaps tweaking the outline shader logic.

@0b5vr
Copy link
Contributor

0b5vr commented Aug 24, 2023

The behavior is not well-defined on the spec side, and if we try to strictly define the spec this is going to be a spec as-is.
Until we define a platform-independent way to achieve smoother outlines for these cases, you probably should resolve these cases by model side (e.g. inserting a small bevel 😩).

@0b5vr 0b5vr added the enhancement New feature or request label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
2 participants