Skip to content

Normal: Don't flip normals when using flat shading.#30823

Merged
sunag merged 4 commits into
mrdoob:devfrom
Mugen87:dev1
Mar 30, 2025
Merged

Normal: Don't flip normals when using flat shading.#30823
sunag merged 4 commits into
mrdoob:devfrom
Mugen87:dev1

Conversation

@Mugen87

@Mugen87 Mugen87 commented Mar 30, 2025

Copy link
Copy Markdown
Collaborator

Related issue: https://discourse.threejs.org/t/webgpu-flatshading-doubleside-broken/80198

Description

The PR ensures normals are not flipped when using flat shading.

@github-actions

github-actions Bot commented Mar 30, 2025

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.08
78.29
336.08
78.29
+0 B
+0 B
WebGPU 532.64
148.02
532.77
148.04
+127 B
+26 B
WebGPU Nodes 532.11
147.91
532.24
147.94
+127 B
+26 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.09
112.16
465.09
112.16
+0 B
+0 B
WebGPU 604.28
163.99
604.41
164.01
+127 B
+19 B
WebGPU Nodes 559.32
153.43
559.39
153.46
+76 B
+22 B

@Mugen87 Mugen87 added this to the r176 milestone Mar 30, 2025
@Mugen87 Mugen87 marked this pull request as draft March 30, 2025 09:22
@Mugen87 Mugen87 changed the title Normal: Don't flip normals when using flat shading. FrontFacingNode: Don't flip normals when using flat shading. Mar 30, 2025
@Mugen87 Mugen87 marked this pull request as ready for review March 30, 2025 09:37
@Mugen87 Mugen87 changed the title FrontFacingNode: Don't flip normals when using flat shading. Normal: Don't flip normals when using flat shading. Mar 30, 2025
Comment thread src/nodes/accessors/Normal.js
@Mugen87 Mugen87 marked this pull request as draft March 30, 2025 09:55
@sunag sunag marked this pull request as ready for review March 30, 2025 15:06
@sunag sunag merged commit aa7f5b9 into mrdoob:dev Mar 30, 2025
@WestLangley

Copy link
Copy Markdown
Collaborator

If the front side is extruded by a normal map, then the back side should be indented. With this PR, both sides are extruded when flat shading is true.

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.

3 participants