Skip to content

WebGLRenderer: Force flat shading for geometries without normals. #32831

Merged
mrdoob merged 3 commits intodevfrom
webgl-normals-fallback
Jan 23, 2026
Merged

WebGLRenderer: Force flat shading for geometries without normals. #32831
mrdoob merged 3 commits intodevfrom
webgl-normals-fallback

Conversation

@mrdoob
Copy link
Owner

@mrdoob mrdoob commented Jan 23, 2026

Description

Previously, geometries without normals would render black with materials that require normals for lighting calculations. Users had to manually set material.flatShading = true or call geometry.computeVertexNormals() as a workaround.

The renderer now detects this case and automatically uses flat shading, which computes normals from screen-space derivatives in the fragment shader.

mrdoob and others added 2 commits January 23, 2026 16:06
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mrdoob mrdoob added this to the r183 milestone Jan 23, 2026
@github-actions
Copy link

github-actions bot commented Jan 23, 2026

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 356.57
84.67
356.71
84.7
+142 B
+34 B
WebGPU 621.78
172.66
621.78
172.66
+0 B
+0 B
WebGPU Nodes 620.38
172.43
620.38
172.43
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 489.35
119.68
489.5
119.71
+142 B
+34 B
WebGPU 692.75
187.97
692.75
187.97
+0 B
+0 B
WebGPU Nodes 642.41
175.15
642.41
175.15
+0 B
+0 B

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mrdoob mrdoob merged commit c57ccd0 into dev Jan 23, 2026
10 checks passed
@mrdoob mrdoob deleted the webgl-normals-fallback branch January 23, 2026 07:42
@mrdoob
Copy link
Owner Author

mrdoob commented Jan 24, 2026

@Mugen87 @sunag

I've tried to get Claude to port this change to WebGPURenderer but it can't figured it out. Can you give it a go?

In order to repro:

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.

1 participant