Skip to content

WebGLPrograms: Don't use flat shading with enabled wireframe. #31242

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

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jun 8, 2025

Fixed #31238.

Description

The PR makes sure that flat shading is only used when material.wireframe is disabled.

Note that when toggling material.wireframe with enabled flat shading, you must set material.needsUpdate to true so the shader gets updated correctly. That is a small compromise since checking the wireframe property per frame adds additional cost to the renderer and that is potentially not appropriated for this edge case.

@Mugen87 Mugen87 marked this pull request as ready for review June 8, 2025 09:18
Copy link

github-actions bot commented Jun 8, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.4
78.67
337.42
78.68
+18 B
+3 B
WebGPU 554.99
153.61
554.99
153.61
+0 B
+0 B
WebGPU Nodes 554.34
153.46
554.34
153.46
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 468.59
113.33
468.61
113.33
+18 B
+3 B
WebGPU 630.02
170.38
630.02
170.38
+0 B
+0 B
WebGPU Nodes 584.87
159.73
584.87
159.73
+0 B
+0 B

@Mugen87 Mugen87 added this to the r178 milestone Jun 10, 2025
@Mugen87 Mugen87 merged commit 651306b into mrdoob:dev Jun 10, 2025
12 checks passed
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.

MeshNormalMaterial flat + wireframe = broken
1 participant