Skip to content

Conversation

@visansm
Copy link

@visansm visansm commented Sep 18, 2025

PR #31242 introduced an issue where flat shading would not work for a MeshMatcapMaterial without explicitly setting material.wireframe = false, because by default material.wireframe is undefined for MeshMatcapMaterial . This PR makes it so flat shading can be enabled when wireframe is undefined.

@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.24
79.14
338.24
79.14
+0 B
+2 B
WebGPU 584.78
161.56
584.78
161.56
+0 B
+0 B
WebGPU Nodes 583.39
161.32
583.39
161.32
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 469.7
113.74
469.7
113.75
+0 B
+2 B
WebGPU 654.13
177.06
654.13
177.06
+0 B
+0 B
WebGPU Nodes 608.25
166.24
608.25
166.24
+0 B
+0 B

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 18, 2025

@WestLangley Any reasons why you didn't add wireframe to MeshMatcapMaterial? It seems all Mesh* materials support it.

@WestLangley
Copy link
Collaborator

Actually, I am much more concerned that flat shading no longer works with MeshMatcapMaterial.

Git bisect indicates flat shading was broken on MeshMatcapMaterial by #31242.

//

Any reasons why you didn't add wireframe to MeshMatcapMaterial?

I think MeshMatcapMaterial should be used to render meshes -- not lines.

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 18, 2025

Materials like MeshNormalMaterial also have this property. The wireframe property has debug purposes so I would say it's more consistent to add it to MeshMatcapMaterial as well.

I think MeshMatcapMaterial should be used to render meshes -- not lines.

Given this argumentation, we would have to remove wireframe from all Mesh* materials. None of these are intended for points and lines.

@WestLangley
Copy link
Collaborator

WestLangley commented Sep 18, 2025

I have never liked the use of "lit" materials on wireframes. I think it is better to render lines with unlit.

I would prefer to keep MeshMatcapMaterial as-is, rendering meshes, not lines.

I'd focus on fixing the broken flat-shading, instead.

EDIT: I decided to add support for wireframe. See #31917.

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 18, 2025

TBH, I think it's better to add wireframe to MeshMatcapMaterial for consistency reasons. This should automatically fix flat shading since the matcap material is now treated like all other mesh materials. Also the wireframe property is an important debugging feature that we definitely should keep.

@mrdoob What is your preference here?

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 18, 2025

Closing in favor of #31917.

@Mugen87 Mugen87 closed this Sep 18, 2025
@Mugen87 Mugen87 added this to the r181 milestone Sep 18, 2025
@mrdoob
Copy link
Owner

mrdoob commented Sep 19, 2025

TBH, I think it's better to add wireframe to MeshMatcapMaterial for consistency reasons. This should automatically fix flat shading since the matcap material is now treated like all other mesh materials. Also the wireframe property is an important debugging feature that we definitely should keep.

@mrdoob What is your preference here?

Adding wireframe to MeshMacapMaterial is the best solution for this yep!

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