Skip to content

getParallaxCorrectNormal: Keep axis-aligned directions finite. - #35049

Merged
Mugen87 merged 3 commits into
mrdoob:devfrom
bhouston:parallax-correct-normal-fix
Oct 17, 2026
Merged

Mugen87 merged 3 commits into
mrdoob:devfrom
bhouston:parallax-correct-normal-fix

Conversation

@bhouston

Copy link
Copy Markdown
Contributor

getParallaxCorrectNormal() divides by each component of the direction, so axis-aligned directions, such as a floor or wall normal used for the diffuse lookup, divide by zero and produce infinities or NaNs. This clamps each component away from zero while keeping its sign. It also picks the box face with one vector select() instead of three scalar ones. Results are unchanged for all other directions. Verified with webgpu_materials_envmaps_bpcem on the WebGPU and WebGL 2 backends.

Needed by #35046 (reflection probes), which now uses this helper for box projection.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

📦 Bundle size

Full ESM build including core, minified and gzipped.

Before After Diff
Core 392.32
102.83
392.32
102.83
+0 B
+0 B
WebGL 778.74
194.39
778.74
194.39
+0 B
+0 B
WebGPU 1103.65
297.07
1103.65
297.07
+0 B
+0 B
WebGPU Nodes 1101.60
296.72
1101.60
296.72
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 518.96
124.67
518.96
124.67
+0 B
+0 B
WebGPU 781.98
209.31
781.98
209.31
+0 B
+0 B
WebGPU Nodes 728.09
195.89
728.09
195.89
+0 B
+0 B

@Mugen87 Mugen87 added this to the r187 milestone Oct 17, 2026
@Mugen87
Mugen87 merged commit 30057f1 into mrdoob:dev Oct 17, 2026
8 of 9 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.

2 participants